I want to add 2 posts daily, so when the first post is published it should not be published unless and until the 2nd post is published. I am confused on how to do this.

I have searched about wp_publish_post() function but this will not help, is there any way to do this ?

I know there is no code or anything, because I am confused and did not find anything regarding this. I only need some help on how to start, rest I can do.

1 Answer 1


Setup cron job

You want to do some action (i.e. publishing a post) periodically, so first you need to schedule a cron job. Cron jobs are actions, that are fired periodically at some sort of a time interval.

You can either use (non-perfect) Wordpress Cron or replace it with a real cron job on your hosting.

In cron action, publish one of the post with status draft

Inside the cron job, you can query for 1 post with the post_status === 'draft'. If one is found, change its post_status to publish with wp_update_post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.