Using this code in the functions.php
does the trick:
function wpse_44020_logout_redirect( $logouturl, $redir )
{
return $logouturl . '&redirect_to=' . get_permalink();
}
add_filter( 'logout_url', 'wpse_44020_logout_redirect', 10, 2 );
Note – The above code works only on non-admin pages. To make this work on any page you should replace:
return $logouturl . '&redirect_to=' . get_permalink();
With:
return $logouturl . '&redirect_to=http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
Related Posts:
- Adding fields to the “Add New User” screen in the dashboard
- How to check if a user exists by a given id
- Use author author display name in permalink structure for pages and posts
- Get a list of all available fields in the User Profile
- How to paginate the get_users function?
- How to display random users with avatars
- Masking logout URL
- How to manually activate user in dashboard only by admin
- Add new user : make the fields First Name and Last name required
- Logout/login redirect CSS issue
- wp_delete_user with username
- Change labels on ‘Nickname’ and ‘Biographical Info’ in user-edit.php
- Order get_users() by last login date. Is it possible?
- How can I tell when a user is logged in?
- how to get and display logged in user’s recently read posts
- Displaying a random user with a shortcode
- How to update BuddyPress xprofile fields programmatically? [closed]
- How to detect first visit of a user?
- Can I pass two roles to the function get_users?
- How can I add an image field to BuddyPress Extended Profile Fields? [closed]
- Create dropdown of users in admin dashboard
- password protected post policy
- Remove the deleted users avatar from list
- Get Current User info using wp_localize_script, in functions.php
- How to add custom fields to my custom registration form
- create shortcode to list users with specific meta key value
- Don’t delete a page if it holds users
- How to make custom column Admin>Users sortable?
- Execute a ultimate member action when user role is updated
- Filter out other users comments. Visualize only own comments and editor role users’ comments
- Force to use STRONG users password and implement rule to prevent REUSE [closed]
- Change label for registration Fields
- Condition OR for current user ID
- How to Use Global Variables Inside Header and Footer
- Secondary Menu and Logged In Users
- Why get_user_by() doesn’t work in my code?
- Filter to wp_list_authors
- Logout Redirect and also WP-login.php Redirect
- How to add array [closed]
- Add Link to Users List (Backend) to open each users front-end profile
- Suggest Users basing on User taxonomy
- Showing user profile data on front-end
- Modify function to only return values for the user that’s logged in
- loginout function customization
- User meta and public function security
- call wp_insert_user in custom class doesnt work
- Get users with different roles and call function on each of them (user_meta)
- Add Login and logout buttons to top menu bar
- Show errormessages on wrong username/password on custom loginform?
- How can I show different content for different user-levels?
- Custom user role still showing up after deletion, ideas?
- referencing the current user in a page i created in wordpress
- Show metadata in users.php – wordpress
- Deleting guests profile users after 1.5 hours
- wp_get_current_user return ID = 0 when used outside of wordpress, such as webhook / fulfillment dialogflow
- Allow user only create specific tags
- Add Change role button for list of user in an event
- get_current_user_id() always return 0 in if else statement
- Show users last read posts for each user?
- How to add number to wordpress count function?
- get USER ID in functions.php using user_register action
- Whats the proper way to add a new user via a front end form?
- Logout redirect via page template without confirmation?
- sort by date in users
- How to change the markup WordPress inserts for post images
- When tax_query used, results disappear (0 =1 produced)
- Is it possible to remove the main rich Text box editor?
- Calling a function from functions.php in header [closed]
- Adding Google Analytics to footer selectively
- I changed “Howdy” in the admin bar in the dashboard, but when I’m viewing the site it still says Howdy!
- Custom logo sizes for multiple logos
- how to change link of some wordpress pages
- Add custom image size not working
- When to use an if statement after get_posts?
- Programmatically Create Category and sub Category
- wp_get_attachment_image function size argument not working if I also add a custom class
- Shortcode inserts paragraphs before and after executing shortcode
- Get_template_part inside a folder
- Passing values from a widget to a function within a plugin
- Contact Form 7 – Delay auto responds
- Replace a menu with widget or a custom template file programmatically
- Which functions/classes are available during SHORTINIT?
- How to edit the Tags within the image file URLs?
- Disable wp_is_mobile()
- How to properly set custom logo size?
- Image Crop Not Working
- how get number of twitter followers in wordpress
- How to Display WooCommerce Product Price in WooCommerce Archive
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Its my first time trying to create a website , I got an error Please help
- Load scripts into an AJAX div
- restrict uploaded image size and fixed image display size
- Code executes outside of Loop while same code gives ‘Uninitialized string offset’ notice inside a while loop
- Function not receiving string from shortcode
- Restricted images only for logged user. (hidden url)
- WordPress permanently logging users out
- Syling Custom Fields echo’s from from functions.php
- Shortcodes not outputting in correct divs
- Help finishing script to export WP user data when form submitted
- WordPress enque the same script causes the setInterval not to work