john-michael
Member
Posted 2 years ago #
The following code is supposed to remove a specified category from a post and update the publish date of the post. This part works, however the script seems to be replacing < br /> tags with < br > tags.
Anyone have an idea why or how to prevent that?
if ($post_id_to_update) {
$args='';
$old_terms = wp_get_post_terms( $post_id_to_update , $taxonomy, $args);
$new_terms = array();
if ($old_terms) {
foreach ( $old_terms as $old_term ) {
if ($old_term->term_id != $term->term_id) {
$new_terms[]=$old_term->name;
}
}
}
wp_set_post_terms( $post_id_to_update, $new_terms, $taxonomy, $return );
}
$my_post = array();
$my_post['ID'] = $post_id_to_update;
$my_post['post_date'] = date("Y-m-d H:i:s");
$my_post['post_date_gmt'] = gmdate("Y-m-d H:i:s");
wp_update_post( $my_post );
$wpdb->flush();
john-michael
Member
Posted 2 years ago #
Update,
The above code also removes flash object code, for example,
This code,
<object width="400" height="265"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=10666627&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=10666627&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="265"></embed></object><p><a href="http://vimeo.com/10666627">My Ballins Is Magnificent</a> from <a href="http://vimeo.com/drthil">Dan Thilman</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
Is changed to this after the script runs,
<p><a href="http://vimeo.com/10666627">My Ballins Is Magnificent</a> from <a href="http://vimeo.com/drthil">Dan Thilman</a> on <a href="http://vimeo.com">Vimeo</a>.</p>