'r8_tracking_scripts', 'post_title' => $script->script_name, 'post_content' => '', 'post_status' => 'publish', 'meta_input' => array( 'r8_tsm_script_code' => $script->script_code, 'r8_tsm_active' => $script->active ? 'active' : 'inactive', 'r8_tsm_script_order' => $script->order ? $script->order : 1, 'r8_tsm_script_location' => $script->location, 'r8_tsm_script_page' => $script->page_id ? array( $script->page_id ) : array(), ), ); $post_id = wp_insert_post( $script_post ); return false; } /** * Complete * * Override if applicable, but ensure that the below actions are * performed, or, call parent::complete(). */ protected function complete() { parent::complete(); // Show notice to user or perform some other arbitrary task... delete_option( 'header_tracking_script_code' ); delete_option( 'page_tracking_script_code' ); delete_option( 'footer_tracking_script_code' ); delete_option( 'tsm_is_processing' ); } } }