stop redirection on /wp-admin call to /wp-login

thanks to Tomasz Struczynski who has explained and answered my question completely You Can See The Answer At This Link First – explanation. WordPress is kind of tricky, when it comes to admin pages. Essentially, when admin page is being loaded, wp-admin/admin.php is being included. Inside this file there is a call to a function … Read more

Redirect on successful login

According to the Codex page for wp_redirect(), you should follow your wp_redirect() calls with exit. add_action( ‘wp_login’, ‘redirect_on_login’ ); // hook failed login function redirect_on_login() { $referrer = $_SERVER[‘HTTP_REFERER’]; $homepage = get_option(‘siteurl’); if (strstr($referrer, ‘incorrect’)) { wp_redirect( $homepage ); exit; } elseif (strstr($referrer, ’empty’)) { wp_redirect( $homepage ); exit; } else { wp_redirect( $referrer ); … Read more

How to 301 private posts rather than 404?

Sorry guys, I found my answer: add_action(‘wp’,’redirect_stuffs’, 0); function redirect_stuffs(){ global $wpdb; if ($wpdb->last_result[0]->post_status == “private” && !is_admin() ): wp_redirect( home_url(), 301 ); exit(); endif; } Posts/Pages are removed from the sitemaps, but the page still shows up on the site so that it can get 301’d.