[wp-trac] [WordPress Trac] #57908: No reference for hook "logout-link" in Documentation
WordPress Trac
noreply at wordpress.org
Sun Mar 12 03:15:56 UTC 2023
#57908: No reference for hook "logout-link" in Documentation
--------------------------+-----------------------------
Reporter: mlheyd | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.1.1
Severity: normal | Keywords: needs-user-docs
Focuses: |
--------------------------+-----------------------------
I am developer but new to WordPress. The following code added to a child
theme functions.php file works perfectly to log a user out and redirect to
the home page. I actually got the code from ChatGTP. I thought I would
check the WP documentation to see how I missed the hook that worked but it
turns out that I cannot find it anywhere.
The issue is that all the documentation uses wp_logout and iterations
thereof but I could not get any of that to work. Here is the super simple
code that works. The issue is, is it documented anywhere.
{{{#!php
<?php
function logout_link_shortcode() {
return '<a href="' . wp_logout_url( home_url() ) . '">Logout</a>';
}
add_shortcode( 'logout-link', 'logout_link_shortcode' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57908>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list