true ], "objects" ); $supported = []; $excluded = [ "attachment", "revision", "nav_menu_item", "custom_css", "customize_changeset", "oembed_cache", "user_request", "wp_block", "wp_template", "wp_template_part", "wp_navigation" ]; foreach ( $post_types as $pt => $obj ) { if ( ! in_array( $pt, $excluded, true ) ) { $supported[ $pt ] = [ "name" => $pt, "label" => $obj->labels->singular_name ?: $obj->label, ]; } } return $supported; } /** * AJAX Handler: Scan site for candidate accordion blocks. */ public function ajax_scan_site_accordions() { check_ajax_referer( "aab_plugin_action", "nonce" ); if ( ! current_user_can( "manage_options" ) ) { wp_send_json_error( [ "message" => esc_html__( "Unauthorized access.", "advanced-accordion-block" ) ], 403 ); } global $wpdb; $selected_post_types = isset( $_POST["post_types"] ) && is_array( $_POST["post_types"] ) ? array_map( "sanitize_text_field", $_POST["post_types"] ) : array_keys( $this->get_supported_post_types() ); if ( empty( $selected_post_types ) ) { $selected_post_types = [ "post", "page" ]; } $selected_convert_types = isset( $_POST["convert_types"] ) && is_array( $_POST["convert_types"] ) ? array_map( "sanitize_text_field", $_POST["convert_types"] ) : [ "rank_math", "core_accordion", "core_details" ]; if ( empty( $selected_convert_types ) ) { $selected_convert_types = [ "rank_math", "core_accordion", "core_details" ]; } $needle_map = [ "rank_math" => [ "