admin管理员组

文章数量:1395198

I have about 25 000+ posts and I need to update all of them.

Main question is if this will make server/hosting down or break anything )

I found this code which goes in functions.php and works, but another problem here is that it sets same published date/time to all posts

function update_all_posts() {
        $args = array(
            'post_type' => 'post',
            'numberposts' => -1
        );
        $all_posts = get_posts($args);
        foreach ($all_posts as $single_post){
            $single_post->post_title = $single_post->post_title.'';
            wp_update_post( $single_post );
        }
    }
    add_action( 'wp_loaded', 'update_all_posts' );

本文标签: Update all posts25 000 posts in total