WordPress get logout address tag: WP_ logout_ url

WordPress template tags WP_ logout_ URL is used to output the login address, which is often used in open registered WordPress sites.

wp_logout_url( string $redirect = '' )

Function parameters


String value, null by default

Provide a URL. When the user logs out, it will jump back to this URL. Generally, it provides the URL of the current page

Examples of function usage

When the user logs out, return to the home page of the website

<a href="<?php echo wp_logout_url( home_url() ); ?>">cancellation</a>

In the article page, the user logs out and returns to the current article page

<a href="<?php echo wp_logout_url( get_permalink() ); ?>">cancellation</a>

No matter which page you log out, you will return to the current page

<a href="<?php echo wp_logout_url( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); ?>">cancellation</a>

Extended reading

wp_ logout_ The url() function is located at: WP includes / general- template.php

Related tags:

  • is_ user_ logged_ in()
  • wp_ login_ form()
  • wp_ loginout()
  • wp_ logout()
  • wp_ register()
  • wp_ login_ url()
  • wp_ lostpassword_ url()
  • wp_ registration_ url()
Related Article
WordPress comment date tag: comment_date

WordPress template tags comment_ Date is used to output the date of a comment, usually in a custom comment template. Read more

WordPress comment summary tag: comment_excerpt

WordPress template tags comment_ Excerpt is used to output the summary of comments. The default output is 20 characters. It Read more

WordPress comment time tag: comment_time

WordPress template tags comment_ Time is used to output the publishing time of the current comment, which is the same Read more

WordPress RSS format comment author name tag: comment_author_rss

WordPress template tags comment_ author_ RSS is used to output the comment author name in RSS format, which has no Read more

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image