Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (php_sapi_name() != "cli") die("You can only run this from CLI.");
- ini_set('max_execution_time', 60000);
- //define('WP_MEMORY_LIMIT', '2048M');
- chdir(dirname(__FILE__));
- define('WP_USE_THEMES', false);
- require('../forum/wp-blog-header.php');
- ob_end_flush();
- global $wpdb;
- include __DIR__ . '/vendor/autoload.php';
- // Use the Forum bundle. It supports BBCodes, emoticons and autolinking
- use s9e\TextFormatter\Bundles\Forum as TextFormatter;
- $query = new WP_Query([
- 'numberposts' => -1,
- 'posts_per_page'=> -1,
- 'post_type' => [ bbp_get_topic_post_type(), bbp_get_reply_post_type() ]
- ]);
- $i = 0;
- while ($query->have_posts()) {
- $query->the_post();
- global $post;
- echo $i++ . " / " . $query->found_posts . " =========================== $post->ID : $post->post_title\n";
- wp_update_post([
- 'ID' => get_the_ID(),
- 'post_content' => TextFormatter::unparse($post->post_content)
- ]);
- }
Advertisement
Add Comment
Please, Sign In to add comment