Last active
March 13, 2020 02:34
-
-
Save coderaaron/79b515fe4b9a6732f3e27b584007c20e to your computer and use it in GitHub Desktop.
Convert content with shortcodes to rendered HTML and update post
This file contains 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
<?php | |
define( 'PPI_FOR_EXPORT', 1 ); | |
$a = get_pages(); | |
foreach( $a as $b ) { | |
$f = $b->ID; | |
$c = get_post_field( 'post_content', $f ); | |
remove_filter('the_content', 'wpautop'); | |
$d = apply_filters( 'the_content', $c ); | |
$my_post = array( | |
'ID' => $f, | |
'post_content' => $d, | |
); | |
$e = wp_update_post( $my_post ); | |
if ( $e == 0 ) { | |
echo "<strong>Error updating post $f<br><strong>"; | |
} else { | |
echo "Successfully updated post $f<br>"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment