GET ?post_type=post&status=publish

  • post_type - Filter by post type (default: all)
  • status - Filter by post status (default: publish)
  • ids - Comma-separated post IDs

' . esc_html__( 'Download file', 'ai-answer-toolkit' ) . '' ); ?>

$post_type, 'post_status' => $status, ); $result = AI_Answer_Toolkit_Export::export_to_file( $args ); if ( $result['success'] ) { wp_safe_redirect( add_query_arg( array( 'page' => 'ai-answer-toolkit-export', 'export_success' => '1', 'download_url' => urlencode( $result['url'] ), ), admin_url( 'admin.php' ) ) ); } else { wp_safe_redirect( add_query_arg( array( 'page' => 'ai-answer-toolkit-export', 'error' => urlencode( $result['message'] ), ), admin_url( 'admin.php' ) ) ); } exit; } /** * Handle settings save. */ public static function handle_save_settings() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'You do not have sufficient permissions.', 'ai-answer-toolkit' ) ); } check_admin_referer( 'aitk_save_settings', 'aitk_settings_nonce' ); // Save API key if ( isset( $_POST['api_key'] ) ) { update_option( 'AI_Answer_Toolkit_api_key', sanitize_text_field( wp_unslash( $_POST['api_key'] ) ) ); } // Save webhook settings $webhook_enabled = isset( $_POST['webhook_enabled'] ) ? true : false; update_option( 'AI_Answer_Toolkit_webhook_enabled', $webhook_enabled ); if ( isset( $_POST['webhook_url'] ) ) { update_option( 'AI_Answer_Toolkit_webhook_url', esc_url_raw( wp_unslash( $_POST['webhook_url'] ) ) ); } if ( isset( $_POST['webhook_api_key'] ) ) { update_option( 'AI_Answer_Toolkit_webhook_api_key', sanitize_text_field( wp_unslash( $_POST['webhook_api_key'] ) ) ); } wp_safe_redirect( add_query_arg( array( 'page' => 'ai-answer-toolkit-export', 'settings_saved' => '1', ), admin_url( 'admin.php' ) ) ); exit; } /** * Enqueue scripts and styles. * * @param string $hook Current admin page hook. */ public static function enqueue_scripts( $hook ) { if ( $hook !== 'ai-answer-toolkit_page_ai-answer-toolkit-export' ) { return; } wp_enqueue_style( 'ai-answer-toolkit-export', AI_Answer_Toolkit_PLUGIN_URL . 'assets/css/export.css', array(), AI_Answer_Toolkit_VERSION ); } } AI_Answer_Toolkit_Export_Page::init();