How to check if the currently viewed page is an endpoint in WordPress?

I have added an endpoint to author links using add_rewrite_endpoint()

I can now have links such as: example.com/author/username/articles

Read More

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? i.e: example.com/author/username/articles

Ref:

https://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint
https://codex.wordpress.org/Function_Reference/is_author

Related posts

Leave a Reply

1 comment