• Hi,

    Question about the get_query_var function and the use of permalinks.

    For a very simple website I use the index file (only) as a template-file (no header/footer/sidebar). In this index file I use some simple code to get the page_id (following this topic: http://wordpress.org/support/topic/209146?replies=3):

    When permalinks are off this works ok:
    $pageid = get_query_var(‘page_id’); (giving me the current page id)

    When pretty permalinks are on this doesn’t work anymore (only the homepage, which I put as I static page in the admin, gives me a pageid of “3”, the other pages are all giving back a “0”)

    As mentioned in the topic above my method should work – with(out) permalinks enabled. But this is not the case, since I can get the “pagename” out of this function when permalinks are switched on.

    I’m a bit confused… what am I doing wrong? Is there an alternative for get_query_var? (this seems to be a very useful function in my opinion..)

    Some help/further info would be great!

    Thanks,

    Rolf

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘get_query_var and permalinks’ is closed to new replies.