I have added an endpoint to author links using add_rewrite_endpoint()
I can now have links such as: example.com/author/username/articles
To check when the currently viewed page is the author page ( example.com/author/username
) I can do this:
if ( is_author() )
But how can I check if the currently viewed page is my new endpoint? ie: example.com/author/username/articles
Ref:
https://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint https://codex.wordpress.org/Function_Reference/is_author
I found the answer:
global $wp_query;
isset( $wp_query->query_vars['articles'] )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.