Last active
February 13, 2016 19:51
-
-
Save twentyfortysix/5658753 to your computer and use it in GitHub Desktop.
WP - content cleaner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cleaner | |
// credits http://wordpress.stackexchange.com/questions/52097/better-way-to-remove-html-syntax-from-all-content | |
$tochange = get_posts('post_type=product&numberposts=-1'); | |
foreach ($tochange as $post): | |
setup_postdata($post); | |
$changed = array(); | |
$changed['ID'] = $post->ID; | |
$changed['post_content'] = strip_tags($post->post_content, '<img><a>'); // post_excerpt | |
print_r($post->ID); | |
echo '<br />'; | |
$out = wp_update_post($changed); | |
echo 'changed:'.$out.'<br />'; | |
unset($changed); | |
endforeach; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment