Home › Forums › ACF PRO › Expire Posts on Datepicker Field › Reply To: Expire Posts on Datepicker Field
Thank’s for your example too. It’s pretty much the same as mine except you also run a transient check so as to avoid running it more than once a minute (I’m guessing?).
A few key differences tho I think worth mentioning is:
1. Always use WP_Query if you can. get_posts() is a wrapper for WP_Query which excludes filters. It’s just good practice tho, don’t think it has any real impact on load times.
2. By using wp_transition_post_status
instead of wp_update_post
we only update the status column in wp_posts table. The benefit of this is that it only handles the status so it’s faster and also it wont trigger any save_post
hooked functions.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.