Controller functionality – if user is not logged in send them to specific page (not wp_login)

The reason why you are getting a not redirecting properly message is because you are creating an endless loop of redirects. They get redirected to /public but because they are not logged in they get redirected again and again and again… Try this code instead: if( ! is_user_logged_in() && ! is_page(“public”) ) { wp_redirect( site_url(“/public”) … Read more

Custom pagination structure

After searching here and there, probably I found solution. (Don’t know if I am doing wrong in WP terminology!) Page was redirecting from …/page5 to …/page/5, because of redirect_canonical function resides in WordPress core. So I further searched for altering it by hook. Few people were saying remove redirect_canonical filter by adding this in code: … Read more

Cannot get redirect working

none of those conditionals will work at after_theme_setup. Look at the Action Reference page in Codex for the order actions are executed in a request. Try hooking template_redirect instead.

Passing User Messages to Another Page

A standard approach is to add a query parameter to the location header (redirect), for example: $redirect = add_query_arg( ‘my-form’, ‘success’, $redirect ); wp_redirect( $redirect ); exit; Then on the redirected-to page, you can conditionally display a message: <?php if ( filter_input( INPUT_GET, ‘my-form’ ) === ‘success’ ) : ?> Congrats! <?php endif ?>

Need help to repair a 301 redirect problem

I know that this is an ancient thread but I ran across it searching for the exact solution in March 2017. I hope this solution is the trial fix that works for someone and saves a little sanity. I posted it in the X Theme support forum since I had been asking for help there, … 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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)