Support » Plugins and Hacks » Developing a plugin: how to get the current page

  • Hi guys.

    How do I get in php code the current page in wich I am (with complete permalink structure with slugs and so on) ?

Viewing 1 replies (of 1 total)
  • You can always use the $_SERVER[‘REQUEST_URI’]. This of course will have any url-encoded query strings tagged on it as well, but you can quickly get rid of that with an explode. For example:

    $page = array_shift( explode( ‘?’, $_SERVER[‘REQUEST_URI’] ) );

    If you still want the query string, simply use $_SERVER[‘REQUEST_URI’] as is.

    Will that work for you?

Viewing 1 replies (of 1 total)
  • The topic ‘Developing a plugin: how to get the current page’ is closed to new replies.