wp_update_post ignores if/else

How is this possible? I can think of one possibility that for some reason ur page is getting auto reloaded. So the flow of execution is like: you access the page, your code gets executed changing status from draft to published, then some other code gets executed and the page is reloaded. This time when … Read more

Cannot update page – with too many characters?

I think it’s not the wp-config.php or .htaccess file you need to edit. The problem is web server related. search for php.ini file in your web server directory and there are some specific limits you may need to configure. like following keywords: upload_max_size’ , ’64M’ post_max_size’, ’64M’ max_execution_time’, ‘300’ I hope it helps and feel … Read more

How to update the children of a post?

get_children returns an array of post objects by default: https://developer.wordpress.org/reference/functions/get_children/ So you would have to use ‘ID’ => $child->ID, in this case… also my want to wrap the foreach with if (count($children) > 0) {} to prevent possible errors where there are no children. ie: $children = get_children( $mainid ); if (count($children) > 0) { … Read more

Set a post expiration and delete a post when expirate

The correct way is to use WordPress Cron and schedule your event. Also you should consider adding real cron job as outlined here for better precision. 1.) I modified your draft_the_post function to support parameter. So now we can specify which post and also i updated the portion that checking the time. 2.) dg_cron_schedule_delete_posts will … Read more