Jump to content
Sign in to follow this  

Help with code to log out of Wordpress

Recommended Posts

My code used to work ok until this latest wordpress update. The latest version has the Log out link in a ul inside a div. I can get my script to simulate a click on the div but after that I can't figure out how to click on the Log Out link. Any ideas?

Here is the WP HTML:

<div id="user_info_links_wrap">
 <div id="user_info_links">
    <a title="Edit your profile" href="profile.php">Your Profile</a>
    <a title="Log Out" href="http://mysite.com/wp-login.php?action=logout&_wpnonce=f93479b1b">Log Out</a>

Here is my code. The loop looking at the inner text used to work but does not work now. The first two lines do work and open up the div.

    $oLinks = _IEGetObjById($oIE, 'user_info_links');

    ;Find and click text link
    $oLinks = _IELinkGetCollection($oIE)
    For $oLink in $oLinks
        $sLinkText = _IEPropertyGet($oLink, "innerText")
        If StringInStr($sLinkText, "Log Out") Then
            _IEAction($oLink, "click")

Share this post

Link to post
Share on other sites

when log out it return to the login page.

So, you could try :

_IENavigate ( $oIE, 'http://wordpress.com/wp-login.php?loggedout=true' )

Yup, that did it. Thanks for the help!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...