You answered a logout redirect question for this guy a while ago, I implemented the code and it worked great, thanks! (http://wordpress.org/support/topic/wp-logout-page-redirect-to-homepage)

My follow up question is how you would format that code to specify a unique URL if it wasn't the home page?

  • 1
    Welcome to WPSE. What kind of landing page do you have in mind: post, page, archive, external webpage, ... ? – birgire May 6 '14 at 21:29
  • Who is "You"? Please read the faq to see what this site is about. Thanks. – kaiser May 6 '14 at 22:03

It looks like you're addressing me ;-)

If you want to modify this code snippet:

add_action( 'wp_logout','go_home' );

function go_home(){
  wp_redirect( home_url() );

you can replace the home_url() part with your custom page URL:


but I wouldn't recommend hardcoding the landing page, if it's an internal page.

You can try to construct the landing page with various WordPress functions:

You have for example get_permalink() and extra input parameters to home_url(). Then there's get_category_link(), get_tag_link(), get_post_type_archive_link(), ... etc.

If you explain what kind of landing page you have in mind (page, post, archive, custom, external) then I can expand it further.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.