I have a custom post type that will manage some jobs positions. I will implement some custom metaboxes that will hold the extra information about the jobs position that will be inserted like typology ecc. I'm not sure about a thing: is possible to set a deadline for the posted position using a metabox? for example, if I post a job position today and I want that the status is updated automatically on closed after a certain date, how I can achieve this? I want to update the status of the position and the possibility to apply for it from the front-end. Any code snippet and help will be appreciated.
I have a custom post type that will manage some jobs positions. I will implement some custom metaboxes that will hold the extra information about the jobs position that will be inserted like typology ecc. I'm not sure about a thing: is possible to set a deadline for the posted position using a metabox? for example, if I post a job position today and I want that the status is updated automatically on closed after a certain date, how I can achieve this? I want to update the status of the position and the possibility to apply for it from the front-end. Any code snippet and help will be appreciated.
Share Improve this question asked Feb 3, 2020 at 19:53 sialfasialfa 32910 silver badges29 bronze badges1 Answer
Reset to default 0Yes, I think you could add the deadline / expiration date for your custom post type as a meta value, which would be set in a custom meta box.
For automating the expiration you could add a custom wp-cron event with a daily schedule. So the event would fire once a day, do a meta query for posts with that date and loop them through to update their statuses (custom taxonomy or post status maybe?).
To ensure the cron event fires each day, you may want to disable the WP Cron and schedule a real cronjob, Should I disable WP_CRON and instead trigger wp-cron.php from server every few mins?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744767158a4592530.html
评论列表(0条)