-type-activity-types', 'wp-type-contacts-subtype', 'wp-type-group', 'wp_bannerize_tax', 'wp_log_type', 'wp_super_faq_category', 'wpbdm-region', 'wpbdp_category', 'wpbdp_tag', 'wpcm_make_model', 'wpdmcategory', 'wpfb_file_category', 'wpfcas-category', 'wpfd-category', 'wplead_list_category', 'wplss_logo_showcase_cat', 'wpm-testimonial-category', 'wpmf-category', 'wpostahs-slider-category', 'wprm_course', 'wprm_cuisine', 'wprm_ingredient', 'wprm_keyword', 'wprss_category', 'wps_forum', 'wpsc-variation', 'wpsc_log_type', 'wpsc_product_category', 'wpseo_locations_category', 'wpsisac_slider-category', 'wpsl_store_category', 'wpt_category', 'wpt_result', 'wpt_scale', 'wpv_sermons_category', 'wpvqgr_tag', 'writer', 'wyz_business_category', 'wyz_business_rating_category', 'wyz_business_tag', 'wzkb_category', 'year', 'years', 'yith_product_brand', 'yith_shop_vendor', 'yst_prominent_words', 'zipcode', 'zoninator_zones', 'zrf_field_group', // End The Backlog @see https://wp.me/p9MPsk-X0. 'bill-status', 'etb-audience', 'etb-state', 'etb-target', 'etb-topic', 'etb-year', 'foia-response-status', 'target-type', 'timeline-pillar', 'timeline-type', // wp.com martketplace search - @see https://wp.me/pdh6GB-Ax#comment-2104 'wpcom_marketplace_categories', // wp.com a8c-support-theme taxonomies. 'kb_category', 'kb_tag', // coolhunting.com 'article-type', ); // end taxonomies. /** * List of options to sync * * @access private * @static * * @var array */ private static $options_to_sync = array( 'jetpack_search_ai_prompt_override', 'jetpack_search_color_theme', 'jetpack_search_result_format', 'jetpack_search_default_sort', 'jetpack_search_overlay_trigger', 'jetpack_search_excluded_post_types', 'jetpack_search_highlight_color', 'jetpack_search_enable_sort', 'jetpack_search_inf_scroll', 'jetpack_search_show_powered_by', 'jetpack_search_experience', 'jetpack_search_ai_answers_enabled', 'jetpack_search_suggestions_enabled', 'jetpack_search_override_woocommerce_search_template', 'reader_chat', 'instant_search_enabled', ); // end options. /* * Taxonomies we know don't sync. * See also sync/src/class-defaults.php * * 'network' * 'post_status' * 'product_cat' * 'tags' * */ // // Hooks into sync. /** * Add Search post meta to the post meta whitelist. * * @param array $list Existing post meta whitelist. * @return array Updated post meta whitelist. */ public function add_search_post_meta_whitelist( $list ) { return array_merge( $list, static::get_all_postmeta_keys() ); } /** * Add Search options to the options whitelist. * * @param array $list Existing options whitelist. * @return array Updated options whitelist. */ public function add_search_options_whitelist( $list ) { return array_merge( $list, static::get_all_option_keys() ); } /** * Add AI Answer CPTs to the post types sync whitelist when AI Answers is enabled. * * @param array $list Existing post types whitelist. * @return array Updated whitelist. */ public function add_ai_answer_post_types( $list ) { $ai_answers_enabled = class_exists( AI_Answers::class ) ? AI_Answers::is_enabled() : apply_filters( 'jetpack_search_ai_answers_enabled', (bool) get_option( 'jetpack_search_ai_answers_enabled', false ) ); if ( ! $ai_answers_enabled ) { return $list; } $list[] = 'wp_guideline'; return $list; } // Indexing functions for wp.com. /** * Check whether a postmeta or taxonomy 'key' is in the indexable * list. This is called by the indexing code on wp.com to decide * whether to include something in the index. * * @static * @access public * * @param string $type Either 'postmeta' or 'taxonomy'. * @param string $key The postmeta key or taxonomy name. * @return boolean */ public static function is_indexable( $type, $key ) { switch ( $type ) { case 'postmeta': return isset( self::$postmeta_to_sync[ $key ] ); case 'taxonomy': return in_array( $key, self::$taxonomies_to_sync, true ); } return false; } /** * * Get the indexing spec for a postmeta key. * * @static * @access public * * @param string $key The postmeta key. * @return array The spec. */ public static function get_postmeta_spec( $key ) { return self::$postmeta_to_sync[ $key ]; } /** * Get all post meta keys that get synced. * * @access public * * @return array List of post meta keys that get synced. */ public static function get_all_postmeta_keys() { return array_keys( self::$postmeta_to_sync ); } /** * Get all option keys that get synced. * * @access public * * @return array List of option keys that get synced. */ public static function get_all_option_keys() { return self::$options_to_sync; } /** * Get all unindexed postmeta. * This is mostly for testing. * * @access public * * @return array List of postmeta that are not synced. */ public static function get_all_unindexed_postmeta_keys() { return array_keys( self::$unindexed_postmeta ); } /** * Get all taxonomies that get synced. * This is mostly for testing. * * @access public * * @return array List of taxonomies that get synced. */ public static function get_all_taxonomies() { return self::$taxonomies_to_sync; } }