-
-
Save sabrina-zeidan/f4f2d9d2fc56c8ef7d00058dca27af26 to your computer and use it in GitHub Desktop.
Publishing function for WP MU Cron [Wordpress]
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
if (!defined('ABSPATH')) {require_once(dirname( __FILE__ ) . '/wp-load.php');} | |
global $wpdb; | |
$blog_id = get_current_blog_id(); | |
$args = array('post_type' => 'post', 'post_status' => 'draft' , 'numberposts' => 50, 'fields' => 'ids'); | |
$future_posts = get_posts( $args ); | |
foreach ($future_posts as $future_post) { | |
$my_post = array('ID' => $future_post, 'post_status' => 'publish'); | |
$upd = wp_update_post( $my_post, true ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment