array( 'fivedp_funnel', '_divi_powers_funnel_definition' ), 'dp_woo_profile' => array( 'fivedp_woo_profile', '_divi_powers_woo_profile_definition' ) ); foreach ( $types as $old => $spec ) { $ids = get_posts( array( 'post_type' => $old, 'post_status' => array_keys( get_post_stati() ), 'posts_per_page' => -1, 'fields' => 'ids', 'meta_query' => array( 'relation' => 'OR', array( 'key' => $spec[1], 'compare' => 'EXISTS' ), array( 'key' => '_divi_powers_starter_asset', 'compare' => 'EXISTS' ) ) ) ); // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- One-time, administrator-only migration of the plugin's two retired record types. foreach ( $ids as $id ) { $result = wp_update_post( array( 'ID' => $id, 'post_type' => $spec[0] ), true ); if ( is_wp_error( $result ) ) { return; } } } delete_transient( 'divi_powers_active_entry_map' ); update_option( 'fivedp_record_types_version', '1', false ); } } add_action( 'init', array( 'Fivedp_Data_Migration', 'run' ), 1 );