I would like to update a WordPress post date from a PHP CLI script.
When I do this "by hand," - I edit the post on the WordPress back office editor - the blog2social plugin "auto-posts" the post on my social networks such as Facebook and Instagram. That's the expected behavior; I've configured blog2social in this way.
Now, I try to automate this, I use the "wp_update_post" function to update the post date to the current date, and the blog2social plugin "auto post" is not triggered.
PHP Code
require_once("/var/www/html/myblog/wp-load.php");
$id = 23056;
$date_time = date("Y-m-d H:i:s");
wp_update_post(
array(
'ID' => $id,
'post_date' => $date_time,
'post_date_gmt' => get_gmt_from_date($date_time),
'post_modified' => $date_time,
'post_modified_gmt' => get_gmt_from_date($date_time)
));
- Can you help me understand/debug why the blog2social plugin "auto post" is not triggered and does not plan to post on social networks?
- Can you share with my steps to steps to debug WordPress when I click on the post "update" button?
Thanks!