• Hi everyone ,

    Since upgrading to 3.6 (I think, haven’t seen a problem before) it seems like the is_page function when supplied with 7 equals true on two different pages.

    To test this I put the following code in:

    <?php if (is_page(7)) {
    echo("IS PAGE 7");
     }
    ?>

    This I did on a test copy of my site located at: svu.vanemst.eu

    These two pages are both showing the “IS PAGE 7” text in the top left corner:
    svu.vanemst.eu/historie
    svu.vanemst.eu/waterlinieweek/7-september-opening-waterlinieweek

    The page ‘/historie’ is actually page id 7. When I check the other page it should be id 1037.

    Anyone heard of this before? It’s almost as if accidentally only the last number is evaluated for the 1037 id 😛

    If I’m just doing something stupid, let me know. I have been looking at a screen for a bit too long.

    Regards,
    Tjibbe

Viewing 1 replies (of 1 total)
  • Thread Starter TjibbeE

    (@tjibbee)

    ok so I was checking out the database entry when I noticed something…

    the post-title and post-name were both starting with ‘7’

    after removing the leading 7 from the page title is_page(7) no longer evaluates to true.

    is this expected behaviour?

    I know is_page can be used to search for both ID, title and slug, but what if I want it to match only ID 7?

Viewing 1 replies (of 1 total)
  • The topic ‘is_page(7) equals true on two different pages’ is closed to new replies.