Code for Redirecting a Page to an External Link in WordPress

by Scott Stanchak

WordPress provides a blogging platform for producing content on any number of topics. While keeping viewers on a website as long as possible is key, exposing them to other sites is also important. Along with external links, HTML redirects are a way to send viewers from one of your Web pages to a third-party page.

How It Works

A redirect takes a visitor from one Web page to another with zero effort on the vistor's part. This go-to Web page can be either an internal or third-party link. The visitor does not see the redirect code, as it is hidden within the HTML of the primary page.


HTML redirect code can be placed inside a Page or Post in WordPress. Both options are available in the left navigation menu of your website's Dashboard. Make sure the tab for "HTML" and not "Visual" is active in the edit window. If you put the HTML code under the "Visual" version, the code itself will display on your Web page and the page will remain static.

The Code

Place the following HTML redirect code in a WordPress Page or Post: This code tells your browser to auto-refresh the current Web page. When it does, it loads the URL in the "url" string. The "0" attribute associated to "content" determines how many seconds before the redirect takes place. The attributes associated with "content" and "url" are the only ones you should alter.


If you plan on setting the redirect HTML "content" attribute to "0," then a blank HTML document is all that's necessary. If you plan on inputting a number higher than zero, it's best to tell your visitors that you're taking them to a different website. Inform them that they'll be taken off of your site and sent to a new one. If there is no message, they may think their screen went blank and close the window before the redirect takes place.

About the Author

Scott Stanchak has been a professional journalist since June 2000, specializing in sports and technology. He has contributed to,,, Time Warner, AT&T and Clear Channel, among other media outlets. Stanchak graduated with a bachelor's degree in communication arts from Ramapo College in New Jersey.

Photo Credits

  • photo_camera Comstock/Comstock/Getty Images