The wp-redirect tag has no wiki summary.
6
votes
1answer
2k views
Pretty permalinks for search results with extra query var
I'd like to know how I can rewrite a search URL that also contains an extra query var into a pretty permalink using wp_redirect and the template_redirect hook.
I have taken the code from the Nice ...
4
votes
2answers
952 views
Why is wp_redirect() preferable to a standard PHP header redirect?
In asking a question about hooks and redirects, I was advised to use wp_redirect in place of the PHP header function. Just wondering why wp_redirect is preferable?
3
votes
4answers
657 views
Using a Theme inside a Plugin directory
I am building a mobile friendly plugin and put the theme directory inside the plugin directory.
If it's a mobile browser, how can I redirect to the theme in the plugin directory?
...
3
votes
1answer
114 views
Redirect after deleting post and keep track of pagination
I have a custom post list in the admin panel. This list is paginated, so this is it's url :
wp-admin/edit.php?post_type=xxx, if I open the default page
wp-admin/edit.php?post_type=xxx&paged=n, ...
2
votes
3answers
1k views
How to 301 private posts rather than 404?
How do I 301 redirect private pages, rather than 404 them? If a post is private, WordPress filters it out in the SQL query, so there are no $post variables to work with.
I'd like for this code to ...
2
votes
2answers
409 views
wp_redirect not working after submitting form
I'm using this redirect after inserting a post. It's not working, it only refreshes the page the form is on. I know the $pid is getting the post ID so what is the problem? This is the very end of my ...
2
votes
1answer
638 views
redirect out of wp-admin, without losing admin-ajax.php
I'm trying to keep all non-administrators out of the Wordpress admin panel by using a wp_redirect inside of an is_admin conditional. The problem is that a side effect of this if that non-admins can no ...
2
votes
1answer
994 views
Force users to complete their profile after they register? How to
I am making a custom (quick) registration page in my wordpress site, to let users to register quickly by just filling username-email and choose their password.
I have tpl-edit-profile.php,
what ...
2
votes
2answers
757 views
Password change when the user login first time
I have a "change password" page.
Is there a way to redirect that page when the user login first time using wordpress generated password?
Thanks
2
votes
1answer
25 views
How to set Active plugins as the default screen?
In my testing environment, I've got one hundred plugins. I'm more interested in seeing first the Active plugins than the complete list (All).
How can I change the default screen for the Plugins menu ...
2
votes
1answer
172 views
redirect pages with no content, instead of 404 error, using max_num_posts?
I have a site that has changed its pagination structure, resulting in a huge amount of 404 errors (more posts are being shown per page than previously, so there are lots of pages that were once ...
2
votes
1answer
55 views
Redirect users away from Admin breaks ajax
Tried to make a simple redirect for some users I don't want to access the wp-admin/, so I did this code:
function no_admin_access() {
if ( !current_user_can( 'delete_posts' ) ) {
...
2
votes
2answers
908 views
How to Rename wp-login.php for Multisite?
I want to hide and rename wp-login.php in my URL for branding purposes on a Multisite set up.
From this forum post I see that I can change mysite.com/wp-login.php to mysite.com/login by inserting a ...
2
votes
1answer
286 views
Can't get rewrite rules working
Basically I want to rewrite:
/edit/test-post
to an existing page with a parameter:
/edit?e=test-post
From the examples in the Codex I created:
add_filter( ...
1
vote
2answers
2k views
Where does wp_redirect need to be placed to make it work?
I've got a front end post editing page located at mysite/post_id/edit and am trying to redirect users that are not the author back to the post. Here's the code I'm working with:
<?php
...
1
vote
1answer
1k views
How to hide/redirect the author page
I have a website where I let people subscribe. I would like to only show the author page for actual authors who have written a post. I wrote this code that checks for post the problem is I can't use a ...
1
vote
1answer
1k views
wp_redirect not working in header, exit is breaking page
Sorry to ask such a basic question, I've looked at other questions and not found an answer. I've customized some public pages with their own header-public.php, and I'm doing a basic login check for ...
1
vote
1answer
826 views
Controller functionality - if user is not logged in send them to specific page (not wp_login)
This sounds dead bang simple, but I just can't figure it out.
I want the following functionality:
If user is not logged in and they try to access anywhere on the site (including the homepage) - send ...
1
vote
1answer
421 views
Action wp_login_failed not working if only one field is filled out
I created a login form in the frontend with wp_login_form().
In my functions.php file I added an action to prevent the redirect to /wp-login.php if the login failed with
...
1
vote
1answer
666 views
Can I change default registration link (without htaccess)?
I'm using url like «wp-login.php?action=register&role=patient» and «register_form» hook for add extra inputs form which depends on urls like this:
...
1
vote
1answer
83 views
Using wp_redirect and .htaccess to re-route searches (and pass along the remaining GET vars)
I'm trying to use wp_redirect() to redirect searches to a format that I have established in .htaccess. Unfortunately, I'm running into some problems doing this.
I need to redirect search to a series ...
1
vote
1answer
189 views
Redirect wp-login
I have a custom page called owner-login that has a wp_login_form()
How can I disable wp-login.php so that:
when a user writes wp-admin/ it will redirect him to the owner-login (if not logged)
when ...
1
vote
0answers
69 views
Firing a function AFTER redirect
I am using a function that redirects the user to a custom page, rather than wp-login in the event of errors. In my case I am using the Http Referer function to send the user back to the same page ...
1
vote
0answers
254 views
How to use nonce with front end submission form?
Thanks to a variety of posts on here I've managed to put together a front end submission form. After about 24 hours of tweaking I've finally got everything working including a redirect to a 'success' ...
1
vote
1answer
511 views
How to do 302 redirects “in” WordPress using Redirection plugin?
I am planning to use the Redirection plugin to do redirects. The plugin's description states that it also enables 302 redirects, but I can't see how. There's no option as such (see screenshot below).
...
1
vote
2answers
122 views
Need help to repair a 301 redirect problem
I have been having problems with my website and as a result did a Crawl test in SEOmoz.
The test found a 301 Permanently Moved Redirect of all the pages on the website and it appears that they are ...
0
votes
3answers
766 views
wp_redirect “headers already sent” after front-end submission form
I'm trying to practice with setting up a front-end post submission form. And I'm getting this error:
Warning: Cannot modify header information - headers already sent by (output started at ...
0
votes
1answer
19 views
How can I prevent redirects from mysite/page to mysite/wp path/page?
Apparently this is built into WP somwhere since going to mysite/wp-login.php takes me to mysite/<wp path>/wp-login.php (same for wp-admin and I presume other paths).
The problem is, I don't ...
0
votes
2answers
89 views
Redirect on successful login
I am using the following snippet to control redirects after successful logins....
add_action( 'wp_login', 'redirect_on_login' ); // hook failed login
function redirect_on_login() {
...
0
votes
1answer
50 views
Can Not Redirect from Plugin-Registered Admin Page
I am doing the following in my plugin:
Register a custom admin page and in the callback function (the last parameter of add_submenu_page)
Redirect to another page
However, when I open the custom ...
0
votes
1answer
75 views
block a page from logged out users and redirect to homepage
How am I blocking certain pages from being viewed by logged out users? I have some pages like a dashboard for example that each user has to display their posts an is found in the top level like ...
0
votes
2answers
103 views
How to redirect from one WP site to another
I want to set it up so when you click on a tab on my one site it redirects you to my other site. I've tried every code I can think of and nothing seems to work.
Please help.
0
votes
1answer
84 views
Redirect within wordpress template/plugin
I've done a bit of googling, searching on forums, etc, and can't find a good answer.
Here is what I'm doing:
I need to pass a variable in the url to the page and have a rewrite to make it pretty. So, ...
0
votes
2answers
48 views
Require re-login when logged-in user attempts to access restricted page
I need to restrict access to certain frontend pages, based on a user_meta field.
All works fine, except when the user is already logged in but with the wrong credentials. In that situation I would ...
0
votes
1answer
141 views
This webpage has a redirect loop issue
I want to redirect non logged in users to page id = 2 which have registration form.
function checkLogged()
{
$pg = get_permalink();
if (!is_user_logged_in() && !is_front_page() ...
0
votes
1answer
62 views
Temporary redirect prevents getting $_POST array
I'm sending a form from a woocommerce plugin.
I've tweaked the thankyou.php page and added email sending functionality.
However the $_POST array is empty.
Inspecting with Chrome Dev Tools I found ...
0
votes
2answers
84 views
Redirect from the dashboard to edit.php if wp_is_mobile() is true
Looking for a way to redirect the user from the dashboard straight to edit.php if wp_is_mobile() is true.
This is what I've tried:
function redirect_if_mobile() {
$screen = ...
0
votes
1answer
261 views
Headers already sent - Wordpress core
I'm getting an error on my site regarding "headers already sent":
Warning: Cannot modify header information - headers already sent by (output started at ........./wp-admin/menu-header.php:161) in ...
0
votes
1answer
200 views
using wp_redirect to redirect to a permalink
I'm using wp_redirect to change the URL of my 404 page:
function show_404($message = 'page not found'){
wp_redirect(home_url() . '/error/404?m=' . urlencode($message));
exit();
}
I have ...
0
votes
1answer
126 views
wp_sanitize_redirect strips out @ signs (even from parameters) — why?
In my wordpress site I have a hack that looks at the uri and does a redirect to a subdomain. The problem is wp_redirect calls wp_sanitize_redirect which will strip out @ signs, so when a user tries to ...
0
votes
2answers
145 views
Redirect the non-www version of the site to the www
In wordpress site how to Redirect the non-www version of the site to the www version to remove duplicate content
0
votes
2answers
1k views
BuddyPress redirecting to home page on login
I have two sites (towermix.com and beta.towermix.com) running BuddyPress and both are doing the same thing. When a site admin (or contributor or author) logs in using the WordPress login page, they ...
0
votes
2answers
604 views
Question about proper use of wp_redirect?
I'm attempting to create a Twitter style stream, so basically just index, a tag archive, and maybe a page or two while prohibiting access to everything else. For instance, they try to access a single ...
0
votes
1answer
170 views
Cannot get redirect working
I can't get wp_redirect working correctly? I thought I'd figured this out (see wp_redirect not working when going to www version of site) but apparently not; no idea what changed between last week ...
0
votes
2answers
1k views
Checking if a user is logged in, if so redirect to a different page
I'm making a member-only site that requires users to be logged in to use the site.
The homepage is publicly viewable. On the homepage, I'd like to put in a function to redirect users to a page inside ...
0
votes
1answer
149 views
Does WordPress send a 301 header message when you change permalink structures?
I have a super old blog that I upgraded from 2.0.7 to 3.1 by upgrading over multiple versions. One of my biggest concerns was losing all the link juice from my legacy URLs but they were clearly made ...
0
votes
1answer
177 views
Error messages when adding code to function.php or trying to delete inactive plugin files
Error message below:
Warning: Cannot modify header information - headers already sent by (output started at /home/content/79/7603579/html/listings/wp-content/themes/OIB theme/functions.php:519) in ...
0
votes
2answers
217 views
Redirecting simple big problem
i'm a little worried here.
I'm trying to redirect EVERYONE that access my site to a specific webpage, and nothing is working! Currently i'm trying this code:
function redirect_this() {
...
0
votes
1answer
251 views
Date based redirects of posts that no longer exist
I want a more elegant way to express the following redirect:
RewriteCond %{REQUEST_URI} ^/blog/2008/(.*) [NC, OR]
RewriteCond %{REQUEST_URI} ^/blog/2009/01/(.*) [NC, OR]
RewriteCond %{REQUEST_URI} ...
0
votes
0answers
16 views
wp_redirect shows header already sent message
I am new to wordpress plugin development. I have created a list page and an add item page. When I add successfully, I want to redirect and it is giving me this error.
Notice the error is on ...

