Support

Account

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