Support » Fixing WordPress » widget reports wrong page ID

  • I have a really strange problem. I am trying to get the page id so that I can make a current css tag within a widget.
    As a test, I was using this code to display the path:
    <?php
    $url_endpoint = get_permalink($post->ID);
    $url_endpoint = parse_url( $url_endpoint );
    $url_endpoint = $url_endpoint[‘path’];
    echo $url_endpoint;
    ?>
    and comparing it to:
    $_SERVER[‘REQUEST_URI’]

    They don’t match! For some reason within the widget, the wrong page is being reported, ie the first code gives me back:
    /who-we-are/john
    and the second (correctly) reports that we are on:
    /who-we-are/sally

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘widget reports wrong page ID’ is closed to new replies.