div id disappears after saving page in wordpress

I am encountering a strange problem in wordpress as the ‘id’ attribute gets disappeared from the ” after saving page in wordpress.

This means if I try to save ” in a page then after save it shows ”.

Read More

I don’t get a clue to fix this issue.

So please help me in sorting out this problem as soon as possible.

Thanks in advance.

Related posts

Leave a Reply

1 comment

  1. The problem and solution are described in detail here: http://wordpress.org/support/topic/wp_update_post-strips-css-id-attribute?replies=7

    In short, this is due to WordPress’ KSES module, which according to WordPress,

    …makes sure that only the allowed HTML element names, attribute names and attribute values plus only sane HTML entities will occur in $string.

    According to the post, one of the contributors solved this problem by “inserting the following code just before the call to wp_update_post.”

    global $allowedposttags;
    $allowedposttags['div'] = array('align' => array (), 'class' => array (), 'id' => array (), 'dir' => array (), 'lang' => array(), 'style' => array (), 'xml:lang' => array() );
    $allowedposttags['iframe'] = array('src' => array () );
    

    For a global solution, make sure to include:

    define('CUSTOM_TAGS', true);