[lcw_redirect]

Estimated reading: 2 minutes 79 views

🔗 Shortcode: [lcw_redirect]

Description

The [lcw_redirect] shortcode allows you to redirect users to another page on your site — smoothly and automatically!
You can even show a friendly message or some custom HTML while the redirect happens.
Perfect for thank-you pages, post-login redirects, or any situation where you want to guide your visitors seamlessly to the right place.


🧩 Usage

Just 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 above for 5 seconds before being redirected to the /thank-you page.


⚙️ Attributes

Attribute Type Description Default
url string (Required) The site-relative URL path to redirect to, e.g., /thank-you. Avoid using a full external URL.
delay int Number of seconds to wait before redirecting. Great for displaying a short message first. 0 (instant redirect)
target string Specifies where to open the URL: _self, _blank, _parent, or _top. _self
disable_for_admin boolean When set to true, the redirect will be disabled for administrator users.
This is useful when you’re testing or editing the page and don’t want to be redirected.
false

✅ Features

  • 🔹 Site-relative URLs — automatically works with your WordPress site path.
  • 🔹 Custom messages or HTML displayed before redirect.
  • 🔹 Adjustable delay for a smoother user experience.
  • 🔹 Option to disable redirect for administrators.

🧠 Example Scenarios

Redirect after a short delay with a message:

[lcw_redirect url="/thank-you" delay="3"]
  You’ll be redirected in 3 seconds...
[/lcw_redirect]

Immediate redirect with no message:

[lcw_redirect url="/login"]

Redirect to a new tab:

[lcw_redirect url="/external-resource" target="_blank" delay="2"]
  Opening in a new tab...
[/lcw_redirect]

Disable redirect for admin users:

[lcw_redirect url="/thank-you" delay="3" disable_for_admin="true"]
  Redirecting... (Admins won’t be redirected)
[/lcw_redirect]

⚠️ Error Handling

If the url attribute is missing or empty, you’ll see this message:

URL is required for redirect shortcode

Leave a Reply

Your email address will not be published. Required fields are marked *

Share this Doc

[lcw_redirect]

Or copy link

CONTENTS