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
- How do I make my child theme re-apply the settings that were customised when its parent was active?
- How to add a new product type on woocommerce product types? [closed]
- How to add Disqus comment count
- Can WP Customizer work with single pages or posts?
- Enabling Sessions in WordPress 3.0
- can I orderby one custom field and meta_query another in the same query
- WP Super Cache separate cache for mobile
- How do I remove a word from a url in WordPress using .htaccess?
- Search through custom post type and custom fields takes 5 minutes
- ensure user can only be logged in on one computer at a time?
- WordPress prompt checklist before publish?
- Preventing Search Engines Indexing Pages 2, 3 and More?
- where can i add custom script to stop header video from autoplay
- How to store foreign language characters in WordPress? [closed]
- enqueue script on custom post type archive page
- Virtual Pages plugins
- What’s the easiest way to periodically (automatically) read static Markdown content into a WP page?
- Is it possible to replace PHP with NodeJS?
- Change separators in HTML tags
- Problem with using wp-load.php outside of WordPress
- How to remove padding and margin between divi rows? [closed]
- Cannot figure out how to center div in WordPress theme [closed]
- How to implement a custom password field that redirects to another page upon correct password?
- Adding custom field in all widgets, but at the top of the form, in admin area
- WordPress customizer Preview not loading
- Always logged in even if remember me is unchecked?
- Adding posts to custom menu [closed]
- How to add an extra variable to login and authenticate it?
- Theme Customization through admin panel. (Appearance-Customize)
- Diffrent User registration form for doctor and patient
- User can not login
- 404 (category, pages, archives) when using custom rewrite rules
- the_post_thumbnail() returns nothing even though has_post_thumbnail() returns true
- How to customize and keep things up-to-date?
- Problem with custom user meta field
- What are “best practices” for wp-config.php
- What happens to the mu-plugins folder when you upgrade to WordPress 3?
- digital alarm clock widget
- In WordPress 3.x, I can’t access posts from all blogs in the network
- WordPress Install Issue, Receive Warnings But Successful Install
- how to make a custom field readonly or disabled by user role?
- How to make wordpress use a non-wordpress users table?
- Allow multisite admins only to create users with one specific user role?
- Make tag archive display post are ordered by post format
- Proper way to set up rewrite with Wp
- How to Clear Empty Search values?
- Create Miltiple Category Base
- Custom CSS Nav Menu Style Not Being Applied
- How to show the hero of website when sending website link?
- How to get WordPress Theme Customizer options in the REST API?
- Creating a WP Test site without /uploads etc
- How to define active widget with js in a customizer
- where can i find the login page in wordpress and add my header to it
- Unable to write error_log output… but only from a certain function
- Best way to sort posts with different types by distance
- How come there is no wp-content directory in wp theme
- Image Upload Failing from WP_Editor
- Custom field front end update in wordpress
- What shortcode should I use for
- Database custom table issues – incorrect result displayed
- Special characters showing in fallback font
- How to strip thumb from widget
- Customize Admin Section
- Want home page to click through to two different page types
- add unique code required to register
- How to create functions that affect only a specific user
- How to add custom page using them in wordpress 3.5
- woocommerce display product category on checkout page [closed]
- I need a plugin in wordpress like google tasks [closed]
- Particle.js not loading in WordPress Gutenberg
- Is it possible to show related posts on WordPress attachment pages?
- How to add filters to my site?
- How to use same username account for multiple users?
- Post does not disappear
- wordpress categories narrow down results
- Why after customizing Home Page, the site is loading six missing blob sources, slowing down all site?