[lcw_redirect]
🔗 Shortcode: [lcw_redirect]
Description
The [lcw_redirect] shortcode lets you redirect users to another page on your site after an optional delay.
You can also display a custom message or HTML content while the user waits for the redirect to happen.
It’s perfect for thank-you pages, login redirects, or any situation where you want a smooth transition.
🧩 Usage
Place the shortcode on any page or post like this:
[lcw_redirect url="/thank-you" delay="5" target="_self"]
Please wait 5 seconds... redirecting.
[/lcw_redirect]
In this example, users will see the message while waiting, and then be redirected to the /thank-you page after 5 seconds.
⚙️ Attributes
| Attribute | Type | Description | Default |
|---|---|---|---|
url |
string | (Required) Site-relative URL path to redirect to, e.g., /thank-you. Do not use the full URL. |
— |
delay |
int | Number of seconds to wait before redirecting. | 0 (instant redirect) |
target |
string | Where to open the URL: _self, _blank, _parent, or _top. |
_self |
✅ Features
- 🔹 Site-relative URLs: automatically prepends your WordPress site URL.
- 🔹 Custom content: show messages or HTML while waiting.
- 🔹 Delay: redirect after a specified number of seconds.
🧠 Example Scenarios
Redirect after a short delay with a message:
[lcw_redirect url="/thank-you" delay="3"]
You will be redirected in 3 seconds...
[/lcw_redirect]
Immediate redirect with no message:
[lcw_redirect url="/login"]
Redirect to open in a new tab:
[lcw_redirect url="/external-resource" target="_blank" delay="2"]
Opening in a new tab...
[/lcw_redirect]
⚠️ Error Handling
If the url attribute is empty or missing, the shortcode will display the message:
URL is required for redirect shortcode
