Publishing function for WP MU Cron [Wordpress]
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