Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad
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
http://codex.ww.wp.xz.cn/Function_Reference/get_page
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.
Page and Post IDs are constant. They never change. Only the db table id changes.
esmi, ah thanks for the precision.