Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How can I get the current path of my page?

I know how to do it inside a template file, but I need it inside functions.php. And it has to be before the send_headers hook, because I'll use this info to set a cookie.

I tried using PHP, but I'm getting /wp-admin

share|improve this question
Do you mean parse_url( $_SERVER['REQUEST_URI'] )? –  toscho Apr 16 '13 at 10:28
Do you want to get path or URl of page? –  Vinod Dalvi Apr 16 '13 at 10:29
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.