403 ) ); } check_admin_referer( 'ajaco_reset' ); $options = array( 'ajaco_markdown_enabled', 'ajaco_content_signals_enabled', 'ajaco_api_catalog_enabled', 'ajaco_mcp_server_card_enabled', 'ajaco_agent_skills_index_enabled', 'ajaco_webmcp_enabled', 'ajaco_json_ld_enabled', 'ajaco_openapi_enabled', 'ajaco_indexnow_enabled', 'ajaco_llms_txt_enabled', 'ajaco_indexnow_key', ); foreach ( $options as $option ) { delete_option( $option ); } // Flush cached endpoint outputs so the next request reflects the reset state. delete_transient( 'ajaco_openapi_cache' ); delete_transient( 'ajaco_llms_txt_cache' ); // One-shot notice flag — consumed on the next settings page render so a // browser refresh doesn't show the notice repeatedly. set_transient( 'ajaco_reset_notice', 1, 60 ); $redirect = add_query_arg( array( 'page' => 'aj-agent-crawl-optimizer' ), admin_url( 'options-general.php' ) ); wp_safe_redirect( $redirect ); exit; } /** * Show a success notice after a reset. Uses the `settings-error` class so the * existing JS notice-mover relocates it to below the Save button, matching * the standard "Settings saved." treatment. Consumed once via transient so a * page refresh doesn't keep showing it. * * @return void */ function maybe_show_reset_notice(): void { $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null; if ( ! $screen || $screen->id !== 'settings_page_aj-agent-crawl-optimizer' ) { return; } if ( ! get_transient( 'ajaco_reset_notice' ) ) { return; } delete_transient( 'ajaco_reset_notice' ); ?>