0

I want to make one website like a newspaper, so i want to show my daily post for one day or limited time, after one day previous post will go to archive and no longer show on web page, how is it possible?

1

You should use cron job. Yes WordPress has a function wp_schedule_event (). This function will perform certain operations based on the time difference you add it.

Say for example, if you schedule it daily this will works everyday and perform the operarions on daily basis. you can hook a function with wp_schedule_event. Just get the published posts list and from the posts check the date of publish and current time. If it marches today leave it. Otherwise you can edit the post and change the status as draft or you can even delete it. Here I didn't give you code samples. If you require there are many question available about cron job and post status change. Just Go through it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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