Support

Account

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.