Allow Facebook to preview posts before published

Create a new plugin with the following code: class Facebook_Peeker { private static $facebook_bots = [ ‘facebookexternalhit/1.1 (+https://www.facebook.com/externalhit_uatext.php)’, ‘facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)’ ]; private $original_posts; public function make_scheduled_post_public() { add_filter( ‘posts_results’, [ &$this, ‘peek_into_private’ ], null, 2 ); } public function peek_into_private( $posts, &$query ) { if ( sizeof( $posts ) != 1 ) { return $posts; … Read more

Change scheduled posts to published

Ok… so when trying to turn a future post to a published post you need to remember to set “post_date_gmt” and not only the “post_date” to the desired date. Thanks to @gmazzap which helped me get there… here is a working example based on my question /* CHANGE PENDING POSTS TO PUBLISHED POSTS */ function … Read more

How to schedule autopost publishing at each 60 minutes?

You can use the WordPress Cron functionality to schedule a cron job every hour. The only thing you need to hold in mind is that the WordPress cron works different than a normal cron. The action will trigger when someone visits your WordPress site, if the scheduled time has passed. https://codex.wordpress.org/Function_Reference/wp_schedule_event <?php // Schedules the … Read more

Unschedule a post

To revert from scheduled to draft without publishing immediately this works for me (WordPress 3.9.1 ) change scheduled date to yesterday OK Save as draft done

wp_insert_post to schedule a post – but nothing happens?

As Rarst mentioned I had to use wp_update_post(), but then there is a little trick – one must also set edit_date = true otherwise it has funny behavior. The final code looks like this: function schedule() { $postdate = date(‘2014-06-11 01:00:00’); $postdate_gmt = date(‘2014-06-11 05:00:00’); $post = array( ‘ID’ => 11, ‘post_status’ => ‘future’, ‘post_type’ … Read more

Any way to create scheduled post programatically?

I found my answer while searching over other stackoverflow answers below is the code what I’ve added. $postdate = date(‘Y-m-d H:i:s’,strtotime(‘+20 minutes’)); $postdate_gmt = gmdate(‘Y-m-d H:i:s’,strtotime($postdate)); $post = array( ‘post_date_gmt’ => $postdate_gmt, ‘post_date’ => $postdate, ‘edit_date’ => ‘true’ );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)