Im trying to get the current page url while on the wp-admin/admin dashboard, is it possible?
Im trying to use these codes but i can't seem to get it to work.
global $wp;
$current_page = add_query_arg( $wp->query_vars, home_url( $wp->request ) );
The output i wanted is like this: https://example.com/1/wp-admin/admin.php?page=test
But instead, the output turns like this: /1/wp-admin/admin.php?page=test&=https://example.com/1
Any help is greatly appreciated
$_SERVER['REQUEST_URI']
which is whatadd_query_arg
uses behind the scenes. I think you can also technically say$url = add_query_arg([]);
to get it, too – Saving/1/wp-admin/admin.php?page=test
The main domain from the url isnt on the output. – Donatello