The function wp_update_post appears to strip the css id attribute. Can anyone provide leads as to what might really be going on?
The following code (when run from the cygwin command line) prints
<div id="id">bar</div> which suggests to me that wp_update_post is stripping the id attribute.
The value of
$page_id is the page id of an existing page (the home page), and the code fragment leading up to
wp_update_post is stolen from the example section on the reference page for wp_update_post. The code tries to update the page content and then retrieve the page content, and retrieves the unexpected content.
set_include_path(get_include_path() . PATH_SEPARATOR . "./wordpress");
$page_id = 6878; /* page id for existing home page */
$my_post = array();
$my_post['ID'] = $page_id;
$my_post['post_content'] = '<div id="foo">bar</div>';
wp_update_post( $my_post );
$page = get_page($page_id);
echo $page->post_content . "\n";
I am running under Windows XP SP3 with Apache 2.2 with the Zend Engine v2.3.0 version of php. I am running WordPress 3.0.2 with plug ins that include "tiny mce advanced" and "w3 total cache". I've tried googling with phrases including "wp_update_post, strip, css". I've tried reading the code for wp_update_post, wp_insert_post, sanitize_post, etc. I've checked the value of $my_post before and after invoking wp_update_post, and I've confirmed that the value returned by wp_update_post is the page id and not 0.