A Web site that I recently worked on for a client involved tying WordPress together with another CMS including tight login integration. Because of clashes with internal functions, I could not call the WordPress logout function directly from the CMS. Intead, I created a special logout page in the WordPress root which I redirected to from the CMS. Following is the code for that page (logout.php):
<?php
require './wp-load.php';
$current_user = wp_get_current_user();
if ($current_user->ID != 0)
wp_logout();
wp_redirect("https://wordpress.stackexchange.com/");
exit;
You’ll need to somehow secure this, of course. I did so by checking the referrer to make sure the request was coming from the CMS but this might not always be reliable.
Related Posts:
- Add section (add_settings_section) to a custom page (add_submenu_page)
- How to call “page specific menu items” in template [closed]
- How use %like% in sql statement wordpress
- How to make a customize role and view a specific plugins base on that role?
- Creating a Callback URL for WordPress Woocommerce to update Order Status
- Redirect to another page using contact form 7? [closed]
- I cannot include a file in my plugin settings page
- WP Forms not displaying,becomming an fatal error
- Create survey that redirects to sidebar menu customized to answers
- How can I pass value to function in add_menu_page?
- Redirect url in plugin to somewhere else?
- How can I create a navigation menu in the sidebar that can also act like a slider?
- Plugin: Custom menu item problem
- Custom Permalink Plugin and Current Page/Ancestor in Menus
- How can i change the texts of plugin (created by me) in wordpress admin?
- wp-custom-menu filter removes the current_page_item class
- Setup wp_schedule_event within a custom plugin
- WordPress : Explain Plugins & Theme string value in database
- modify plugin to support RTL
- Prevent direct access to WordPress plugin assets?
- execute function after one completed
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- Can I use register_settings and unregister_setting once the settings page has loaded?
- Bulk update wordpress posts
- How to automatically add edit link on frontpage post of any wordpress theme?
- Plugin function inside custom plugin
- plugins_url() works everywhere but wp_reqister_script()
- How to Resize the Custom Post Images?
- Is there a plugin for automatically adding a word or symbol after a trigger word? I.e. Like a search and replace but more like search and add? [closed]
- Integrating boxtal PHP library into a custom WordPress Plugin
- show my own admin_notices after a post has been published
- Class or function wrapper for plugin code
- Licensing a Plugin [closed]
- Add a function call after content automatically?
- WordPress Custom Menu Admin helper plugin
- How to use add_action for multiple instances of the same class
- Plugin option default value
- WordPress plugin with its own “site”/theme
- How can i listing current category and Featured Category post list?
- Dropdown menu on click change
- Custom Module, Extending WP with a Plugin?
- How do I profit from a Plugin?
- help intercepting save_post through plugin
- best way to run a php script away from the template?
- Themes conflicts and overrides my WordPress Support widget Plugin styles
- Disable Author Archive just for certain roles in bulk
- Seperate plugin and theme files
- Add hook after content without formatting
- User loggedin as Subscriber form not sending
- wc_get_template_part doesnt display the content [duplicate]
- How to properly use wp_mail() in my own plugin?
- admin_post hook not firing function inside class
- Thumbnail image doesn’t show up in Shortcode output
- I created a plugin with ‘view page’ that uses MYSQL + PHP. When I use wp_insert_post(), it turns everything to HTML
- list of custom post by custom field in frontend
- How to implement color picker from WordPress in my boilerplate plugin?
- custom post type plugin error [closed]
- how to auto random increment for post view
- Fatal error: require_once(): Failed opening required
- How to properly enqueue jQuery knob on WordPress without conflict?
- Add custom WordPress admin page with pretty url via code
- Problem with wordpress has_action() function
- Admin menu hilighting wrong item for CPT
- How to save the option’s new values plus old value without overwrite old one
- Not displaying Woocommerce product page in lightbox
- ajax voting for custom post type
- Can we validate data from jquery
- WordPress environment not loading properly
- Delete postmeta when uninstall/delete plugin
- how can i get records from wp_postmeta table using particular meta_key in database?
- Inactive Plugin Files
- Saving an array to get_options
- Getting error “The package could not be installed. PCLZIP_ERR_BAD_FORMAT ”
- show Visual form builder in the front end
- Plugin – including external javascript calling google maps
- Help me with my first very basic plugin
- wordpress plugin | short code issue
- Make a Custom template for a specific category in wordpress
- HTML link within my plugin settings page
- How to create post comparison in wordpress
- How to create a sharing marketplace with wordpress for bicycles?
- Custom wordpress plugin does not save select element
- How to set meta-data for my plugin
- WordPress isn’t sending welcome email with the password reset
- A splash page on landing page
- I’m getting the following error: Fatal error: Uncaught Error: Call to undefined function oil_paint_regeneration() [closed]
- how to code activate/deactive button of custom plugin within backend?
- move setting data from wordpress api to codestar freamwork
- How to access the page without registering in wordpress
- CPT template is not being automatically used single post pages
- How to trigger plugin migration code when plugin updates?
- How to Save Category and Delete Category in same Function
- Error 400 Invalid “products[1].productId” Kinguin [closed]
- How to create new title and its description inside a section in WP Customizer?
- Automatically download dependent plugins from WordPress.org?
- How to change the version of block.js and plugin to the same of Package.json?
- Warning “Attempt to read property ‘feeds’ on null” using post update function
- Ajax response from Media Selection does not update ALL information more than once
- How do I apply different block supports to different parts of my custom block?
- Custom Gutenberg blocks not showing in WP editor