It’s not clear, but I’m assuming you want a ‘log out’ url, that brings the user back to the current page?
get_permalink()
however, get’s the permalink of the current post in the loop (if you’re using it outside the loop, you’ll find that it takes the user to the last post in the loop after they log out).
To get the url of whatever page you’re currently on, you can use $_SERVER['REQUEST_URI'];
(if there is a WordPress function that does this, apart from using add_query_arg()
I would like to know it…)
So try:
wp_logout_url( $_SERVER['REQUEST_URI'] );
Related Posts:
- Pagination is not working, how to trace it properly?
- Get the current page URL (including pagination)
- Get current URL (permalink) without /page/{pagenum}/
- Removing the redirect after changing a page’s slug
- Date based URLs for custom posts and pagination
- URL rewrite based on a custom field value
- How do I turn off 301 redirecting posts (not canonical)?
- Subdomains to pages
- Redirect old permalinks to new permalinks
- + Character in permalink
- How can I include a query string with get_permalink
- Nicest way to 301 Redirect traffic when changing permalink settings
- Redirect short-form URL to long-form URL (post_id to post_id + post_name)
- WordPress on VirtualBox – no pretty permalinks
- Stop redirecting to posts not in a category / duplicate slugs
- WordPress 3.4 Permalinks Redirection Problem
- Random Alphanumeric Key URLs
- Rewrite-Rules not working on a vhost, everything goes to index.php
- Using WP rather than .htaccess to redirect pages/posts
- Does WordPress send a 301 header message when you change permalink structures?
- Add ‘articles’ prefix before blog posts url without affecting pagination
- WordPress redirection problem after moving to a new server?
- How to 301 all posts
- WordPress within specific sub-directories, implicitly not root
- Get canonical link
- Clean install – Changing permalinks in twentyeleven give 404
- Post incorrectly displaying as page
- Custom permalink for search and pagination
- If I change permalink structures, can I use htaccess to permanantly redirect links?
- Redirect parent taxonomy to it’s child
- Need Help Correct Regular Expression Redirect Code
- Infinite redirects after changing the permalink of a page
- Does rename of page slugs create 301 redirects from old slug to new (same as for posts)?
- How to Get Page 2 / Paginated RSS Feed with Custom Permalink Structure?
- Custom Permalink
- Pagination Issue – /page/2 404
- Change permalinks on move from one site to another
- next_posts_link URL does not include name of custom post type
- List / Get post redirects
- Redirects after permalink change
- Redirect /%year%/%monthnum%/%day%/%postname% [closed]
- How to 301 redirect from one url to another properly
- Redirect a Blogger Page URL to wordpress
- Redirecting all posts after changing URL structure with htaccess
- Redirect all posts permalinks from “.html” to “/”
- how to redirect old blog post urls when permalinks are changed
- Htaccess https 301 problem
- 301 Redirect for Non-Date Based URL’s
- Passing the JQuery string to Worldpress URL
- How do I make 301 redirection from `/%post_id%/` to `/%postname%/`?
- Freeze child page URLs so parent permalink changes don’t give 404s?
- Permalinks settings
- Resolve 404 on posts without category
- How to handle paging/pagination with a custom permalink?
- Some Pemalink problems, probably caused by wrong .htaccess configuration?
- Change permalink structure for pagination only
- Comment author url link is wrong? How to change from authors/ to author/
- Strange behavior with a redirect loop – involves WPML multi-language plugin
- Redirecting “wrong” but working links to their canonical URL in order to prevent search engine penalties (e.g. /123/ at the end of URLs)
- After cloning WP do a subdirectory, I can’t access it
- Pagination using paginate_links
- Arabic permalink redirect to home page
- Getting an ID from a URL, why can WP do this itself, but none of of the functions provided get it right?
- Custom permalink structure with %postname% in front of domain name
- Configuring Home Page Address
- Redirect after permalink changes
- Pagination url for page template
- Blogger To WordPress Permalink Redirection
- problem with pagination in custom permalinks
- Permalinks and page store
- Change url of page according to my requirements in wordpress
- How to redirect old permalinks from https://exmaple.com/category/post_id to https://exmaple.com/category/post_id.html
- corrupted URLs – can’t leave starting page
- How can i fix my permalinks?
- remove SLASH on single_post but KEEP on categories and parent pages
- Whole site’s pagination not working after rewriting product permalink
- WordPress /page/2 gives 404 when custom permalinks is set to %category%%postname%
- How to redirect old permalinks to ones generated by [WP-Hashed-ID] plugin?
- Redirect old /%category%/%postname%/ to just /%postname%/
- why wordpress keeps redirecting to old page after deleting it?
- 301 redirects after changing permalinks
- Disable “similar permalink” redirect [duplicate]
- Change permalink structure with post id
- redirect any category in URL to the ID and post-name only – hundreds of pages affected
- Post redirected to page with same name but DIFFERENT permalink
- changing permalink gives 404 error for old links
- How to hide slug numbers with htaccess
- WordPress Pagination Not Working After Transfer from Localhost
- Add Custom Pagination Permalink
- Search page Paginations not working
- Redirect Pretty Permalinks to Ugly Permalinks
- WordPress permalink still not working (error or not understood?)
- Removed and Reinstalled WordPress, Redirect Broken now
- How to change pagination base from slash to query form?
- redirect old pages by .htaccess
- My wordpress site must be being affected by outside sources [duplicate]
- Why are all pages redirecting to homepage when using custom permalinks?
- Getting the terms from “Beautiful Taxonomy Filters” Results ot Integrate into “Ajax Load More”
- .htaccess regex for redirect subdomain to root domain & redirect old permalinks
- 404 posts error after 301 redirection of changed category / tag base