Auto expire wordpress post

  • Participant
    Level: Guru
    Posts: 771
    Tosin on #25013


    How can I auto expire published post in a specific category. I have a category called sponsored but I want each article published in this category to auto expire (revert to draft or trash) after 30 days. A 30 day expiry time stamp will be applied immediately to every post published into the sponsored category. Please I don’t mean that all post in the sponsored category should expire at the same time, because the post are being published at different times, so the time stamp is applied per post.


  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2541
    Ravi on #25014

    Hello Tosin,

    Thank you for posting. It can be doable using the WordPress Cron features. You can check the documentation here.


    All you need to do is

    Step 1: Setup a cron job which runs daily one time.
    Step 2: With callback function get all the posts form your categories whose published date is older than 30 days.
    Step 3: Update post status

    Or check this plugin



    • This reply was modified 3 years, 5 months ago by Ravi.

You must be logged in to reply to this topic.

This topic is: not resolved