I’ve run into a problem I have not confronted earlier than so I am hoping somebody could have a solution or answer.
I am an updating a number of posts on the identical time with wp_update_post
with a string worth of This can be a piece of <em>string</em>
for example. The code is as follows:
foreach ( $aposts as $spost ) {
$post_id = $spost->ID;
$content material = $spost->post_content;
$newcontent = preg_replace( $regex, $replace_string, $content material );
$revcontent = array( 'ID' => $post_id, 'post_content' =>$newcontent, );
$ppost = wp_update_post( $revcontent );
}
It loops by means of the posts and modifications the content material. Nevertheless if the content material is wrapped with <em></em>
, it is changed with unicode characters e.g. u003cu003eThis is a bit of stringu003cu003eu003e
.
If I replace the content material inside WordPress admin by clicking on “Replace”, the content material modifications as meant with <em></em>
intact. Unfiltered HTML
is enabled.