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
- Pass PHP variable to javascript
- Does the number of downloads displayed for a plug-in in the WordPress.org plug-in directory include automatic updates?
- Namespaces in WordPress – How do I initiate the main class?
- wordpress get meta value by meta key
- What areas to Unit test while building a plugin?
- Function to activate WordPress theme inside a plugin
- What is the correct way to check if WP_Filesystem can write to a directory without aking for username / password?
- Errors while using ajax from external wordpress page
- Pass A Value From Outside To A Plugin Variable
- shortcode doesn’t work
- Built in admin ajax hooks?
- Could someone please help me to add category id with in this query so this will return posts from a certain category?
- How to handle autoloading with composer by keeping the WordPress naming conventions?
- Current user in plugin returns NULL
- What are the benefit in adding hook in the init() hook?
- How can I implement a notification system in wordpress?
- Minimum PHP Required for WordPress
- building plugin and it is displaying above plugins page
- load_theme_textdomain path
- Dynamic CSS Vs Inline Issues in Code any Way around in a WordPress Themes?
- Building an email signup form. Where should the information be saved in the DB?
- plugin development: problem with functions
- WP Post Template – Templates in own folder
- Create entire wordpress as a github repositery?
- How to update post’s content on post publish?
- Conditional attributes and logic per product category
- Why Is This Code Causing The Admin Bar to Disappear?
- Displaying Custom Sidebar Without Modifying Theme’s Core File?
- Can I create a table on my DB without creating a plugin?
- WordPress checkbox and Illegal string offset
- Is it fair to use MIT licensed code in WordPress plugins? [closed]
- How to add an element right after the article using jQuery?
- How to reset wordpress but not plugins and settings
- Include a php file from another plugin
- How do I make a secure API call from a shortcode when a button is clicked?
- PHP script from functions php is loaded via admin-ajax to div…and the result is 0, not the desired content
- Can the uniqueness of the plugin file/plugin slug and version number be trusted?
- add_submenu_page returns null
- get_option / wp_localize_script Not Working in OOP Plug In
- Switch from wp-cron to a server cron job
- How to Show Author image and url in WordPress plugin directory? [closed]
- How can I add a fixed vertical menu to my site? [closed]
- WordPress plugin: efficient way to store large data
- Remember the Meta Value With Radio Buttons
- jQuery code didn’t run on my plugin
- The Events Calendar Plugin – List View Background Colour Issue [closed]
- Custom characters of tinymce editor are saved as question mark
- Adding a jQuery modal dialog to the admin area
- How to make a Product page without ordering and database
- wp_options not returning value for logged out users?
- Gutenberg default attributes are empty when accessing in edit
- i need to make custom cron_schedule with custom interval time as a parameter into a custom payment gateway plugin wordpress
- How to upload large media file in chunks, without any plugin?
- How to store a secret for a plugin inside public_html
- Cannot run script properly with my custom plugin
- Cookie value changes back to previous value after changing
- Hide all Admin Notices and move on a separate page
- How to use functions found inside pluggable.php with my plugin files
- Is it okay to make a plugin to the WordPress repo, but limit it’s actions to maximum N events?
- WordPress Dashboard add user password not working, etc
- Highlight admin menu items that are parent of existing core items
- I need to show side menu in wordpress
- Getting all woocommerce products from REST API call in plugin
- AJAX update fails for public/non-admin users
- WordPress Product Detail and catalog
- Page Contents showing in Footer Area
- WordPress plugin changes not updating
- Create Database Tables on Plugin Activation hook
- How to build a navigation menu for long-form texts like this one
- Change page according to fetched GET Parameters
- Shortcode registered from a plugin not recognized
- how to change/remove/hide menu under installed plugins
- How to change a specific page to custom page?
- Get Core Functionality from Within a (Secondary) Plugin File
- wp_update_post call really slow when official Facebook plugin is installed
- Plugin keeps saying needs to be updated and it’s in a constant loop [closed]
- How can I add different menus (different style menu) on each page?
- How use Dynamic hyperlink on each wordpress post?
- _e in wordpress +
- WordPress Code Access to Restricted Content without Registration
- Activate plugin button do nothing [closed]
- How to add custom html to the Media > Attachment Details modal?
- add_meta_box showing blank screen in my page
- Plugin translations are not loaded from translate.wordpress.org
- Use inline callable for hooks and filters
- Error in using ‘admin_enqueue_scripts’ action through a class
- How do i fix this error?