Well, actually WordPress provides wp redirect
function. And here is a small plugin I’ve used a while back
<?php
$redirect_meta_key = 'redirect_to';
add_action('template_redirect', 'redirect_this');
function redirect_this($nothing)
{
global $wp_query, $redirect_meta_key;
if(is_single() || is_page()) {
$redirect = get_post_meta($wp_query->post->ID, $redirect_meta_key, true);
if('' != $redirect) {
wp_redirect($redirect);
header("Status: 302");
exit;
}
}
}
?>
No all you have to do is to it in a custom field redirect_to
with a value of absolute path to the other page, or alternatively, add a custom meta box
Related Posts:
- Why is my mod_rewrite not working?
- redirect post id to post full url
- How to build custom WP admin with custom URLs
- Why does WordPress 3.0.4 keep deleting the contents of the .htaccess file?
- Remove Author Slug & Replace With Username
- Setting custom search engine indexing for a “dynamic WordPress page” with htaccess
- WordPress slugs and 404 handling takes preference over folders in site root?
- URLs and navigation in custom themes
- WordPress 3.0.1 on IIS 6 Web Server PermaLink Issues
- website with pretty permalinks except pagination
- add_feed rewrite overwriting standard permalinks
- Many Rewrite Parameters/Rules
- How can I resolve a .htaccess internal server error setting up a WordPress multisite?
- How do I run a web app in my WordPress theme without the “wp-content/theme/…/webapp” in URL?
- website is not loading home page (moving from one server to another server)
- I want to change url structure of my created archieve pages
- How to add rewrite rule for product compare page?
- Problems with running a 2nd installation of WordPress on my domain?
- Url rewriting on custom post with CPT UI plugin
- Page Permalinks: Custom URLs
- Allow arbitrary text after page URL
- wp_rewrite not working on third level url
- Show post content in two different places without redirect
- Create a page for each database table entries
- Display a specified content on a Page and all its child pages
- Adding Theme File for Non-WordPress Content
- Create new network instance, import old single installs AND keep the urls?
- title tag function
- How to do multi site setup
- WordPress 3.1 update has reversed my blog posts
- WordPress Command Question
- getting a 404 page for all pages except home. possibly permalinks
- Different profile page by role
- kitchen sink not working
- WordPress menu: How to make www.link.com/#name never contain current_page_item class?
- Troubles about insering a POST with a SQL query, post_status
- Any Good WordPress Client Like Live Writer To Create Static Pages
- WordPress homepage hangs in IE browsers
- WordPress pagination with custom post type?
- How to retain visual breadcrumbs w/ tricky URL structure? Custom post template?
- 2.9 to 3.0: Pros and cons of upgrading?
- How do I create a Custom Post Box that Connects Different Posts Together
- How to replace blog page url with subdomain at all places, even in xml sitemap?
- Pull Latest Forum Posts within WordPress
- How to setup a membership system in WordPress?
- Where’s did this div element come from?
- query_posts meta_key with current date
- How to activate flash cards
- Add array of post id’s to a category?
- Transferring theme and imported post attachments
- Adding pub_Date to an RSS feed hosted on WordPress
- Get custom field value from not-current page
- Mimicking admin panel menu from wordpress 3.0.1
- RSS feed showing deleted post
- Personalized Gallery what are my options?
- saving the widgets position after drag and drop
- Custom page template, not acting as page
- Google calendar in wordpress showing events
- Trying to use .htaccess to redirect /profile to /login-2?action=profile
- how or where wordress collect unlogged user session
- How to create social Share Buttons Without Plugin
- Add rewrite rule to make Woocommerce product category page seo friendly
- Customize Widget Navigation
- Is it possible to add custom badges to product attributes conditionally, based on custom field?
- wp_enqueue_script JS code runs too late (after user begins interacting)
- Created Custom Block – When I come back to edit post/page and change my block content – Update button stays disabled
- Hook before user is created and make some custom validation
- I found this code to be very useful, how can I change it to a text that display “Product versions and period of last update” rather than a button?
- How do I make Dynamic Student Admission Form?
- WP Search Form Query: Add Author’s posts into search query
- Prevent WordPress from automatically installing a new theme each year
- Setting Parent Page to Post
- Dynamic Sections
- Creating a “Delete”-Button for Metadata userspecific
- Change default Video Player without Plugin
- Changing update message from Newspaper child theme
- Custom default settings for WP native Gallery Block
- Add custom border across footer widget area
- Make the home page template my archive/category page template without code duplication
- Don’t update modify time post on Quick Edit
- Is it possible to auto sharing post on social network from specifc categories or tags
- How to show parent taxonomy using get_the_terms?
- wp_insert_post custom taxonomy multiple Category not added
- Custom menu not showing even though it shows as being registered?
- Open login logo URL in new tab
- Get custom text if in Category
- How to change the login page without a plugin and not only customizing logo and text around the form?
- Conditional Logic on CF7 dropdown options
- Customizing woocommerce product page
- query variables for custom taxonomies
- Change admin_title of a plugin using code snippet/functions
- How to make WordPress search page use a relative path
- Create Miltiple Category Base
- Removing “Failed” query argument upon successful login
- Validate user login in php
- How to get Previous Visited Page Information
- Global theme customization multisite
- Select input in metabox not updated
- How to add Custom Css within the Editor?
- Woocommerce custom archive page custom content and shortcode