Join 3,553 readers in helping fund MetaFilter (Hide)


Is it possible to get a custom field on a Wordpress post to expire or delete after a certain date?
September 20, 2012 6:11 AM   Subscribe

Is it possible to get a custom field on a Wordpress post to expire or delete after a certain date?

I have a Wordpress site that lists posts, many of which are events. On the posts that are events I include a custom field that includes HTML that links a user to our booking engine. This inserts a 'book now' link in the post.

I'm wondering if it is possible to get this custom field to disappear after a certain date or time (i.e. after the date/time of the event, the custom field is deleted or at least doesn't appear to the end user). Is it possible to do such a thing in Wordpress?

Kind regards
posted by radiocontrolled to Computers & Internet (3 answers total)
 
Put the date of the event in a custom field. Use php in the theme to check the date; if it's in the past, do one thing. If it's in the future, do something else like display the booking engine link.
posted by jsturgill at 6:18 AM on September 20, 2012


Use something like this Post Expirator plugin, that i have no connection to or experience with.
posted by softlord at 6:42 AM on September 20, 2012


I use jsturgill's method, but instead of a custom field (where you have to rely that the user inputs the date correctly), I change the "Published" date of the post the date of the future event and then use a plugin like this one to set the status of all future posts to published. You'll likely need to create a custom loop to show future posts in reverse chronological order, as well as exclude the Events category from your main loop (if you have other, non-Event posts).
posted by maniactown at 9:09 AM on September 20, 2012


« Older What did I do to my iPhone 4 t...   |  How can i save my relationship... Newer »
This thread is closed to new comments.