public function logout()
	{
		if ( ! $this->is_logged_in() ) {
			return false; // user isn't login.
		}

		$page = $this->getSession()->getPage();
		$logout = $page->find( "css", "#wp-admin-bar-logout a" );

		if ( ! empty( $logout ) ) {
			$this->getSession()->visit( $this->locatePath( $logout->getAttribute( "href" ) ) );

			for ( $i = 0; $i < $this->timeout; $i++ ) {
				try {
					$url = $this->getSession()->getCurrentUrl();
					if ( strpos( $url, "loggedout=true" ) ) {
						return true;
					}
				} catch ( \Exception $e ) {
					// do nothing
				}

				sleep( 1 );
			}

			throw new \Exception( 'Logout timeout' );
		}
	}
public function logout()
	{
		if ( ! $this->is_logged_in() ) {
			return false; // user isn't login.
		}

		$page = $this->getSession()->getPage();
		$logout = $page->find( "css", "#wp-admin-bar-logout a" );

		if ( ! empty( $logout ) ) {
			$this->getSession()->visit( $this->locatePath( $logout->getAttribute( "href" ) ) );

			for ( $i = 0; $i < $this->timeout; $i++ ) {
				try {
					$url = $this->getSession()->getCurrentUrl();
					if ( strpos( $url, "loggedout=true" ) ) {
						return true;
					}
				} catch ( \Exception $e ) {
					// do nothing
				}

				sleep( 1 );
			}

			throw new \Exception( 'Logout timeout' );
		}
	}
public function logout ( ) { if ( ! $ this -> is_logged_in ( ) ) { return false ; // user isn't login. } $ page = $ this -> getSession ( ) -> getPage ( ) ; $ logout = $ page -> find ( "css" , "#wp-admin-bar-logout a" ) ; if ( ! empty ( $ logout ) ) { $ this -> getSession ( ) -> visit ( $ this -> locatePath ( $ logout -> getAttribute ( "href" ) ) ) ; for ( $ i = 0 ; $ i < $ this -> timeout ; $ i ++ ) { try { $ url = $ this -> getSession ( ) -> getCurrentUrl ( ) ; if ( strpos ( $ url , "loggedout=true" ) ) { return true ; } } catch ( \ Exception $ e ) { // do nothing } sleep ( 1 ) ; } throw new \ Exception ( 'Logout timeout' ) ; } }
Log out from WordPress.

@param none
@return bool
@throws \Exception If the page returns something wrong.
Log out from WordPress .