0

I was wondering how could I automatically remove a tag from a post on a certain date? Let's say I have a tag called "upcoming", I would want functionality where I could type in a date and on that date, the tag would be removed.

So basically, have a tag, set date, when date is reached, remove tag.

Best,

Biot

1
  • 1
    One possible solution would be to use a cron job to check your posts custom date field and if its > today's date delete the tag. – RiddleMeThis Apr 17 '19 at 19:57
0

You can use wp_schedule_event( int $timestamp, string $recurrence, string $hook, array $args = array() ) function to automatically remove the tag. This function will run automatically after the given interval. You can set the interval daily.

Daily the function will run and remove the tag from the post if current date is equal to certain date. You can also run it on hourly bases.

Please note that you have to write you function on the hook of schedule event that will check the date and remove the tag.

0

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.