Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Basically I have created a page and it shows up fine.

example of panel page with path set

When I do a arg or current_path on that page it shows as a 404 path, not the one defined in the page.

current_path() => error-404
$_GET[q] => error-404
arg() => array(0 => error-404)

Is there a function that returns the path/URL that is set in the Page?

share|improve this question

Node that current_path() returns the URL path of the current page, not the URL. So on the http://www.example.com/latest-deals page it will return just latest-deals.

If you need to convert that to an actual URL, use url(current_path()), which will return /latest-deals. Or url(current_path(), array('absolute' => TRUE)) if you need the absolute URL.

share|improve this answer
Thank you for the answer @Artem M. Having current path return just a path and then turn that in to a URL is not a problem. It's getting the correct path back that is the problem – Paul Sheldrake Dec 10 '12 at 7:44

current_path() will return the path of the panel page.

The problem I was having was that we are using panels layouts for 404 pages as well. I had a missing file in the theme layer that was generating a 404 error and that was getting picked up and overriding current path for the page.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.