Get the current page URL (including pagination)

Question

Is there a WP function to automatically get the correct URL of the current page?
Meaning if I just opened a single post, the function returns the same as get_permalink(), but if I’m on a paginated instance of a page (when paginating through the comments), the function returns the same as get_pagenum_link(get_query_var('paged')) would do.

I’ve searched the codex but didn’t find what I was looking for. (But even get_pagenum_link() isn’t documented there.)

I know about this function already, but I would be glad if there was a "native" WP function that does the job.

0
Rene Schubert 1 month 0 Answers 6 views 0

Leave an answer