Redirect all users to dashboard unless custom post type
The earliest hook that is_singular() will work on is wp. replace init with wp in your add_action call
The earliest hook that is_singular() will work on is wp. replace init with wp in your add_action call
If you have access to your .htaccess file, try the following RewriteEngine On RewriteRule ^(Your_Artile_Name)\.pdf your_article.php [L,R=301] Substituting your actual file names for ‘Your_article_name’ and ‘your_article’. If you have a Microsoft server, this article explains how to convert .htaccess to web.config
Really depends on how your redirects are set up. But you can check the status code using Firebug (or a comparable tool with a request profiler). Open up the “net” tab in firebug, and hit one of your old URLs. You should** see the request show up at the top of the list, and you’ll … Read more
Sounds like you know what you are doing that’s a good start at a migration checklist 🙂 FWIT … Search and Replace is a very good plugin make sure you have a backup (my plugin DBC Backup 2 can help there) of your SQL database before you run it (just in case) Try to always … Read more
First, make sure that Rewrites are enabled for your server, then add this to your .htaccess file in WordPress’s root directory… RewriteRule your-old-page-permalink/ http://www.yoursite.com/your/new/permalink/ [R=301,L] This is a greedy match, so your-old-page-permalink/ just needs to correspond to the old post’s SLUG (that’s the editable part of the permalink on your post edit screen). So, go … Read more
redirecting not logged in user is the only thing that works 🙂 in the backend. What you are describing is very peculiar. template_redirect is a front-end hook. Your code will never run on the backend, as far as I can tell. You can demonstrate that with this line: add_action(‘template_redirect’,function() {die;}); You can traverse the back-end … Read more
There are two possible solutions for your problem. You can download “Login redirect” plugin from here: http://wordpress.org/extend/plugins/peters-login-redirect/ You should use a login_redirect filter: function my_login_redirect($redirect_to, $request) { $redirect_url = get_bloginfo( ‘url’ ) . ‘/blog/’; return $redirect_url; } add_filter(“login_redirect”, “my_login_redirect”, 10, 3); More information about login_redirect filter: http://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect
Finally it works! What I was doing wrong is putting the code in the WP functions.php file, and not in my custom theme functions.php file. Thanks all!
You can use add_rewrite_rule in WordPress to capture the query args or add_rewrite_endpoint. If you really just want to redirect based on certain rules then template_redirect can be a good place to use a header redirect.
I’d usually use the the Maintenance Mode plugin which also includes some nice headers features and is easy to activate/deactive. Using the settings, if you want a custom splash page, you just put a 503.php file in the active theme and then set the plugin to use that as the redirect landing page.