<?php
/**
 * Updater file to update old options.
 *
 * @package    Smart_Post_Show_Pro
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

update_option( 'smart_post_show_pro_version', '3.3.2' );
update_option( 'smart_post_show_pro_db_version', '3.3.2' );

$old_options = get_option( 'sp-pcp-blocks-setting-options' );

$new_options = array(
	array(
		'block_name' => 'shortcode',
		'show'       => true,
	),
);

update_option( 'sp-pcp-blocks-setting-options', array_merge( $old_options, $new_options ) );

// Delete old page data options.
global $wpdb;
$wp_options = $wpdb->prefix . 'options';
$wpdb->query( "DELETE FROM {$wp_options} WHERE `option_name` LIKE ('smart_post_show_page_id%')" );
