Logout Link

Login/Logout Widget

If you are using the DAP Login/Logout widget on your sidebar, then the login widget automatically turns in to a “Logout” button once a member has logged in. No separate link needed if you’re using this widget. Click here to read more about the Login/Logout widget.

Logout link in your Menu

If you have a custom menu (WP Admin > Appearance > Menus), then you can add a custom link that points to “/dap/logout.php” or “http://YourSite.com/dap/logout.php” to your menu. This link will log your users out of both DAP and WordPress.


Default DAP Member Page

If you use the default member’s area that comes with DAP out of the box – http://YourSite.com/dap/ – then this page already has a “Log out” link at the top.

But if you are putting all of DAP’s member pages within your WordPress blog using our various shortcodes, then you need to publish the DAP logout link in your sidebar (or wherever you choose to).

Here’s the link for logging out of the member’s area:


Replace “YourSite.com” with your actual site name, of course. And then publish the above link anywhere on your blog – sidebar, top menu bar, etc.


NOTE: Clicking on the DAP log out link will log you out of both DAP and WordPress.


Click Here to Leave a Comment Below 15 comments
Mitch - February 3, 2011

I was wondering how to logout of both wordpress and dap at the same time?



Matt - February 6, 2012

Yes I have the same question as Mitch. I have an API being timed out due to them being logged in to wordpress.

Mitch - February 6, 2012

Hi Matt,

You can actually dig into the code a little bit and get wordpress to log out first and redirect to the dap logout page – here is the code I use in my theme to achieve this, note that it is using php if/else to first determine if someone is logged in or out, and then show the appropriate code. Hopefully this shows up correctly in this comment:

else if(Dap_Session::isLoggedIn()) { ?>
<a href="” title=”Logout”>LOGOUT

Mitch - February 6, 2012

Gah! it looks like the code comment didn’t work out at planned. I can email the code to you if you mail me at mitch at pencilkings.com.


Topher - February 21, 2012

Mitch, I am looking to do this same thing. I will email you now, but wanted to thank you for attempting to post…

may try to repost with: [code] [/code]

Veena Prashanth - February 21, 2012

You can also do this:

Visit this url in a browser:

http://yoursite.com/dap/getpath.php (replace yoursite.com with the name of your site).

Say it returns this path to the dap folder on your site: /home/yoursite/yoursite.com/dap

Now use this path to figure out the path to your WP installation. For ex – if your blog is located at /blog, then the path to the blog will be :


If your blog is located at the root of your site, then the path to the blog will be :


Make a note of the path to your blog.

Now set the DAP Admin Panel -> Setup -> Config -> Post Logout URL to point to a php script (say you call it – wordpress-logout.php and upload it to the dap folder on your site). In this php script, you can add the following code:

< ?php require('/home/yoursite/yoursite.com/blog/wp-config.php'); require ('/home/yoursite/yoursite.com/blog/wp-includes/pluggable.php'); wp_logout(); // post-logout redirect URL $redirectURL = "http://yoursite.com"; header("Location: " . $redirectURL); ?>

See if that works.

Topher - February 22, 2012

That worked great on the DAP logout side, thanks!
To get it to work on the WP side as well, I made the following change to the wp-login.php file

Modified wp-login.php

$redirect_to = !empty( $_REQUEST[‘redirect_to’] ) ? $_REQUEST[‘redirect_to’] : ‘dap/logout.php’;

Original wp-login.php:

$redirect_to = !empty( $_REQUEST[‘redirect_to’] ) ? $_REQUEST[‘redirect_to’] : ‘wp-login.php?loggedout=true’;

David - June 11, 2012

Hi Veena, I created the PHP file as you instructed but when I click the LOGOUT link I created the browser just prints the text thats in the PHP file on to the screen. Any insight on this? Thanks!

Veena Prashanth - June 12, 2012

Hi David,

Starting dap 4.3.1, the special code to logout is no longer needed.

If you logout of dap, you will automatically get logged out of WP.

Todd Wilson - October 18, 2012

How can I direct the logout to land on the login page instead of the root page which is my sales page.

Veena Prashanth - October 18, 2012

You can set the ‘logout’ url in dap setup -> config -> Access&Navigation section to point to the login page but if the login page contains %%LOGIN_FORM%%, then upon logout, when the users get redirected to login page, they will see ‘You are already logged in message’ which will be confusing for them.

So instead of taking them to a page with %%LOGIN_FORM%%, you can take them to a page that contains ‘Click here to login’ link. The ‘click here to login’ hyperlink can point to your login page.

Thomas - May 12, 2013

Dear Veena,

I added a custom Logout link in my WP menu :

“/dap/logout.php” and named “Logout”

If I click on this link to logout, DAP bring me to a “non-member page” that says “you successfully logged out”.

But :

When I tipp the URL of a page that should normaly be yet protected, DAP let me access to it.

May I made a mistake to configure the logout ?

Thanks !

PS : I tried it on 3 differents browsers and 2 differents PC

Veena Prashanth - May 14, 2013

Hi Thomas,

After you logout by clicking on the ‘logout’ link in the menu and then visit the login page, does it show the login form or does it say ‘you are already logged-in’ ?

If it shows the login form, then there is no issue with login/logout and the ‘protected content still visible’ issue is likely being caused by something else.

Please see:



Mozie - November 25, 2015

Hi Veena..

I just ran into this issue, sent you a support ticket then followed your suggestion about deactiviting caching plugins. I had WP super cached installed and deactivated it and all those “premium” content pages that were still being access by not premium members is not properly protected.

Thank you!

Closing that ticket right away, will teach me to read your comments too!


Veena Prashanth - November 26, 2015

Hi Mozie,

Are the premium content pages protected now or still not protected?


Leave a Reply: