Home › Forums › ACF PRO › Updating fields duplicates and splits field group › Reply To: Updating fields duplicates and splits field group
Found it. I was using this code in my functions.php:
$showID = $wpdb->get_var( $wpdb->prepare( "
SELECT ID
FROM $wpdb->posts
WHERE post_name = %s
AND post_type= %s", 'show', 'page' ) );
if ( !$showID ) {
$showID = wp_insert_post( array(
'post_name' => 'show',
'post_title' => 'Show',
'post_type' => 'page',
'post_status' => 'publish'
));
}
wp_update_post( array(
'ID' => $showID,
'post_status' => 'private'
) );
Turns out the wp_update_post with just the ID and post_status makes this issue alive. Even though it has the correct ID to the page.
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.