Home › Forums › General Issues › New Field – Auto Update posts in custom post type › Reply To: New Field – Auto Update posts in custom post type
Yes, because the value is not updated, you’re just inserting a default.
To make the filtering work you will need to create a temporary function that queries the posts, loops through them and updates each value.
You have a lot of posts and this could time out.
I would add a meta query to my WP_Query to only get posts where this custom field does not exist, this way you will only update posts that have not value. If it times out the first time you can just keep re-loading the page until they are all updated. https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters
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.