Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a navigation hyperlink in my secondary menu, that will allow the user to logout:

enter image description here

However, the user is prompted with the following screen for confirmation, when clicking on the hyperlink in the secondary navigation menu:

enter image description here

I am currently using the following URL in the navigation menu to redirect the user back to the Accounts page, as a temporary measure:

http://mywebsitenamehere.com/wp-login.php?action=logout&redirect_to=http://mywebsitenamehere.com/my-account/

Is there a way that I can use the WordPress menu above, and place in an appropriate URL to log the user out without the confirmation screen, and then send them back to the page that they were previously on?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You have to hook into the wp_nav_menu_items filter to get the correct link with the nonce, as described here . An example of how to do that can be seen here https://gist.github.com/theukedge/6565746#file-gistfile1-php

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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