Support » Fixing WordPress » Page ID changed

  • I have an issue with the way WP creates a new page id for each page revision.
    Specifically, I use plugins that filter display and functionality based on page ids.
    When a page is revised WP gives it a new ID and although it display correctly, the plugins retain the original page ID and therefore continue to display the old page version on the website, although the view page link on the page edit displays the updated page.

    Is there a way to prevent WP from changing pages IDs after an update?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Jan Dembowski


    Brute Squad and Volunteer Moderator

    When a page is revised WP gives it a new ID and although it display correctly

    Huh? That should not happen. IDs are unique and unchanging. Can you provide an example by way of a link?

    Edit: Here’s the codex link I meant to refer to



    Forum Moderator

    Nope. MySql ids are fundamental to the way in which WordPress stores revisions. The only way around it without changing your plugins would be to turn off all revisions via your wp_config.php file. If it was me, I’d be looking at plugins/solutions that filter based on page slug or title.

    I did a “brute force” fix, by deleting all revisions of page except the current version in PhpMyAdmin. I then updated the page id based on the database info to the new version page id in the code.

    I agree, about finding plugins solutions that use the title or slug. Especially since the latest versions of WP no longer displays page IDs natively.

    Jan The issue became acute when I revised the page that sticks above the rest on the front page.

    I am using the following code:

    /** inserts specific page content */
    $post_id = xx;
    $queried_post = get_post($post_id);
    echo '<h1>'; echo $queried_post->post_title; echo '</h1>';
    echo $queried_post->post_content;
    echo '<p><p/>';
    /** above rests on top of main loop content */

    I feel that instead of re IDing the latest revision of the page, WP should re-ID or rename the older versions so that the current page conserves it’s ID constant.



    Forum Moderator

    Page and Post IDs are constant. They never change. Only the db table id changes.

    esmi, ah thanks for the precision.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Page ID changed’ is closed to new replies.