Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
31.82% covered (danger)
31.82%
7 / 22
18.18% covered (danger)
18.18%
2 / 11
CRAP
0.00% covered (danger)
0.00%
0 / 1
Search
35.00% covered (danger)
35.00%
7 / 20
18.18% covered (danger)
18.18%
2 / 11
67.83
0.00% covered (danger)
0.00%
0 / 1
 name
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 add_search_post_meta_whitelist
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 add_search_options_whitelist
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 add_ai_answer_post_types
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
 is_indexable
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
12
 get_postmeta_spec
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 get_all_postmeta_keys
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 get_all_option_keys
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 get_all_unindexed_postmeta_keys
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 get_all_taxonomies
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Configuration lists for Jetpack Search Fields
4 *
5 * Post Meta: list of post meta keys that are available in the index
6 *   and how they are configured.
7 *
8 * Custom Taxonomy: list of custom taxonomies that are indexed.
9 *
10 * The reason we need an allowed list is that Elasticsearch runs into scaling problems
11 * with more than 200k-ish total fields. The barrier to adding new fields is low,
12 * just open a PR.
13 *
14 * Although the comments indicate specific plugins, you don't need to be running
15 * that plugin for the indexing to work. The metakey just has to match.
16 *
17 * If you need a new meta key or taxonomy also consider using:
18 *   jetpack-search-meta0 - jetpack-search-meta9
19 *   jetpack-search-tag0 - jetpack-search-tag9
20 *
21 * @package automattic/jetpack-sync
22 */
23
24namespace Automattic\Jetpack\Sync\Modules;
25
26if ( ! defined( 'ABSPATH' ) ) {
27    exit( 0 );
28}
29
30/**
31 * Class to handle sync for Jetpack Search.
32 */
33class Search extends Module {
34
35    /**
36     * Sync module name.
37     *
38     * @access public
39     *
40     * @return string
41     */
42    public function name() {
43        return 'search';
44    }
45
46    /**
47     * Constructor.
48     */
49    public function __construct() {
50        // Post meta whitelists.
51        add_filter( 'jetpack_sync_post_meta_whitelist', array( $this, 'add_search_post_meta_whitelist' ), 10 );
52        // Add options
53        add_filter( 'jetpack_sync_options_whitelist', array( $this, 'add_search_options_whitelist' ), 10 );
54        // AI Answers CPTs and post meta (gated by feature flag).
55        add_filter( 'jetpack_sync_post_types_whitelist', array( $this, 'add_ai_answer_post_types' ), 10 );
56    }
57
58    /**
59     * Post meta search specification.
60     *
61     * We sync and index all meta keys in this list. Additionally there are a few
62     * options.
63     *
64     * 'metakey' => [ 'searchable_in_all_content' => true ],
65     *    Field will be included in the all_content fields
66     *
67     * 'metakey' => [ 'available' => false, 'alternatives' => [ 'metakey_processed' ] ],
68     *   Field not in meta.* but has data in an alternative field(s) name that
69     *   should work similarly. For instance, woocommerce total_sales does not go into
70     *   the index, but the percentage of sales does.
71     *
72     * @static
73     * @access private
74     * @var array
75     */
76    private static $postmeta_to_sync = array(
77        // jetpack.
78        '_guideline_block_jetpack_search-ai-summary' => array(), // AI Answers personality (Gutenberg Guidelines CPT).
79        'jetpack-search-meta0'                       => array( 'searchable_in_all_content' => true ),
80        'jetpack-search-meta1'                       => array( 'searchable_in_all_content' => true ),
81        'jetpack-search-meta2'                       => array( 'searchable_in_all_content' => true ),
82        'jetpack-search-meta3'                       => array( 'searchable_in_all_content' => true ),
83        'jetpack-search-meta4'                       => array( 'searchable_in_all_content' => true ),
84        'jetpack-search-meta5'                       => array( 'searchable_in_all_content' => true ),
85        'jetpack-search-meta6'                       => array( 'searchable_in_all_content' => true ),
86        'jetpack-search-meta7'                       => array( 'searchable_in_all_content' => true ),
87        'jetpack-search-meta8'                       => array( 'searchable_in_all_content' => true ),
88        'jetpack-search-meta9'                       => array( 'searchable_in_all_content' => true ),
89
90        // woocommerce.
91        'exclude_product_categories'                 => array(),
92        'exclude_product_ids'                        => array(),
93        'free_shipping'                              => array(),
94        'id_field'                                   => array(),
95        'individual_use'                             => array(),
96        'limit_usage_to_x_items'                     => array(),
97        'maximum_amount'                             => array(),
98        'minimum_amount'                             => array(),
99        'post_id'                                    => array(),
100        'product_categories'                         => array( 'searchable_in_all_content' => true ),
101        'product_ids'                                => array(),
102        'total_sales'                                => array(
103            'available'    => false,
104            'alternatives' => array(
105                'wc.percent_of_sales',
106            ),
107        ),
108        'usage_limit'                                => array(),
109        'usage_limit_per_user'                       => array(),
110        '_crosssell_ids'                             => array(),
111        '_downloadable'                              => array(),
112        '_featured'                                  => array(),
113        '_height'                                    => array(),
114        '_length'                                    => array(),
115        '_price'                                     => array(
116            'alternatives' => array(
117                'wc.price',
118                'wc.min_price',
119                'wc.max_price',
120            ),
121        ),
122        '_prices_include_tax'                        => array(),
123        '_product_attributes'                        => array(),
124        '_product_version'                           => array(),
125        '_regular_price'                             => array(
126            'alternatives' => array(
127                'wc.regular_price',
128            ),
129        ),
130        '_sale_price'                                => array(
131            'alternatives' => array(
132                'wc.sale_price',
133            ),
134        ),
135        '_sale_price_dates_from'                     => array(),
136        '_sale_price_dates_to'                       => array(),
137        '_sku'                                       => array( 'searchable_in_all_content' => true ),
138        '_stock_status'                              => array(),
139        '_wc_average_rating'                         => array(
140            'alternatives' => array(
141                'wc.ave_rating_score',
142            ),
143        ),
144        '_wc_rating_count'                           => array(
145            'alternatives' => array(
146                'wc.rating', // wc.rating.count_1, wc.rating.count_2, ...
147            ),
148        ),
149        '_wc_review_count'                           => array(),
150        '_weight'                                    => array(),
151        '_width'                                     => array(),
152
153        // co-authors plus.
154        'cap-description'                            => array( 'searchable_in_all_content' => true ),
155        'cap-user_login'                             => array( 'searchable_in_all_content' => true ),
156        'cap-user_email'                             => array(),
157        'cap-last_name'                              => array( 'searchable_in_all_content' => true ),
158        'cap-first_name'                             => array( 'searchable_in_all_content' => true ),
159        'cap-display_name'                           => array( 'searchable_in_all_content' => true ),
160        'cap-website'                                => array(),
161        'cap-jabber'                                 => array(),
162        'cap-aim'                                    => array(),
163        'cap-twitter'                                => array(),
164        'cap-facebook'                               => array(),
165        'cap-google_plus'                            => array(),
166        'cap-job_title'                              => array( 'searchable_in_all_content' => true ),
167
168        // bbpress.
169        'bbpl_like'                                  => array(),
170        'bbpress_discussion_comments_copied'         => array(),
171        'bbpress_discussion_tags_copied'             => array(),
172        'bbpress_discussion_topic_id'                => array(),
173        'bbpress_discussion_use_defaults'            => array(),
174        'bbpress_page_header_bg'                     => array(),
175        'bbpress_title_bg'                           => array(),
176        'use_bbpress_discussion_topic'               => array(),
177
178        // wpml.
179        'tm_meta_wpml'                               => array(),
180        'wpml_language'                              => array(),
181        'wpml_media_lang'                            => array(),
182        'wpml_media_processed'                       => array(),
183
184        // blogger import.
185        'blogger_author'                             => array( 'searchable_in_all_content' => true ),
186        'blogger_blog'                               => array( 'searchable_in_all_content' => true ),
187        'blogger_permalink'                          => array( 'searchable_in_all_content' => true ),
188
189        // geo.
190        'geo_address'                                => array( 'searchable_in_all_content' => true ),
191        'geo_latitude'                               => array(),
192        'geo_longitude'                              => array(),
193        'geo_public'                                 => array(),
194        'geolocated'                                 => array(),
195        'geolocation_city'                           => array( 'searchable_in_all_content' => true ),
196        'geolocation_country_long'                   => array( 'searchable_in_all_content' => true ),
197        'geolocation_country_short'                  => array( 'searchable_in_all_content' => true ),
198        'geolocation_formatted_address'              => array( 'searchable_in_all_content' => true ),
199        'geolocation_lat'                            => array(),
200        'geolocation_long'                           => array(),
201        'geolocation_postcode'                       => array( 'searchable_in_all_content' => true ),
202        'geolocation_state_long'                     => array( 'searchable_in_all_content' => true ),
203        'geolocation_state_short'                    => array( 'searchable_in_all_content' => true ),
204
205        // wp-ultimate-recipe.
206        'recipe_alternate_image'                     => array(),
207        'recipe_cook_time'                           => array(),
208        'recipe_cook_time_text'                      => array(),
209        'recipe_description'                         => array( 'searchable_in_all_content' => true ),
210        'recipe_ingredients'                         => array( 'searchable_in_all_content' => true ),
211        'recipe_instructions'                        => array( 'searchable_in_all_content' => true ),
212        'recipe_notes'                               => array( 'searchable_in_all_content' => true ),
213        'recipe_nutritional'                         => array( 'searchable_in_all_content' => true ),
214        'recipe_passive_time'                        => array(),
215        'recipe_passive_time_text'                   => array(),
216        'recipe_prep_time'                           => array(),
217        'recipe_prep_time_text'                      => array(),
218        'recipe_rating'                              => array(),
219        'recipe_servings'                            => array(),
220        'recipe_servings_normalized'                 => array(),
221        'recipe_servings_type'                       => array(),
222        'recipe_terms'                               => array( 'searchable_in_all_content' => true ),
223        'recipe_terms_with_parents'                  => array(),
224        'recipe_title'                               => array( 'searchable_in_all_content' => true ),
225        'recipe_user_ratings'                        => array(),
226        'recipe_user_ratings_rating'                 => array(),
227
228        // generic fields.
229        // from advanced-custom-fields and metabox.io .
230        'Link'                                       => array(),
231        'Location'                                   => array(),
232        'Title'                                      => array( 'searchable_in_all_content' => true ),
233        'ad_code'                                    => array(),
234        'address'                                    => array(),
235        'admin_mail'                                 => array(),
236        'admin_only'                                 => array(),
237        'advertisers'                                => array( 'searchable_in_all_content' => true ),
238        'age'                                        => array(),
239        'aliases'                                    => array(),
240        'alternate_title'                            => array(),
241        'ama_content'                                => array(),
242        'amazon'                                     => array(),
243        'answer'                                     => array( 'searchable_in_all_content' => true ),
244        'area'                                       => array(),
245        'attention'                                  => array(),
246        'attr'                                       => array(),
247        'author'                                     => array( 'searchable_in_all_content' => true ),
248        'author_name'                                => array( 'searchable_in_all_content' => true ),
249        'blog'                                       => array(),
250        'blog_id'                                    => array(),
251        'call_to_action'                             => array(),
252        'campaign_preview'                           => array(),
253        'canonical_url'                              => array(),
254        'catch_text'                                 => array(),
255        'category'                                   => array( 'searchable_in_all_content' => true ),
256        'classificacao'                              => array(),
257        'classification'                             => array(),
258        'code'                                       => array(),
259        'codigo'                                     => array(),
260        'company'                                    => array( 'searchable_in_all_content' => true ),
261        'company_website'                            => array(),
262        'config'                                     => array(),
263        'construction'                               => array(),
264        'container_ids'                              => array(),
265        'content'                                    => array( 'searchable_in_all_content' => true ),
266        'content_body-full_content'                  => array( 'searchable_in_all_content' => true ),
267        'copyright'                                  => array(),
268        'custom_page_title'                          => array( 'searchable_in_all_content' => true ),
269        'custom_permalink'                           => array(),
270        'customize'                                  => array(),
271        'data'                                       => array(),
272        'date'                                       => array(),
273        'day'                                        => array(),
274        'descripcion'                                => array( 'searchable_in_all_content' => true ),
275        'description'                                => array( 'searchable_in_all_content' => true ),
276        'display_settings'                           => array(),
277        'display_type'                               => array(),
278        'duration'                                   => array(),
279        'embed'                                      => array(),
280        'entity_ids'                                 => array(),
281        'entity_types'                               => array(),
282        'event_subtitle'                             => array( 'searchable_in_all_content' => true ),
283        'excluded_container_ids'                     => array(),
284        'exclusions'                                 => array(),
285        'experience'                                 => array(),
286        'external_url'                               => array(),
287        'featured'                                   => array(),
288        'featured_image'                             => array(),
289        'featured_post'                              => array(),
290        'featured_story'                             => array(),
291        'fee'                                        => array(),
292        'filter'                                     => array(),
293        'follow'                                     => array(),
294        'footer_text'                                => array(),
295        'from_header'                                => array(),
296        'fullscreen_view'                            => array(),
297        'gallery'                                    => array(),
298        'genre'                                      => array( 'searchable_in_all_content' => true ),
299        'guest_bio'                                  => array(),
300        'guest_name'                                 => array(),
301        'guests'                                     => array( 'searchable_in_all_content' => true ),
302        'has_variations'                             => array(),
303        'hashtag'                                    => array(),
304        'header_image'                               => array(),
305        'hidden_from_ui'                             => array(),
306        'hide_on_screen'                             => array(),
307        'homepage_order'                             => array(),
308        'hours'                                      => array(),
309        'i18n'                                       => array(),
310        'id'                                         => array(),
311        'image'                                      => array(),
312        'image_size'                                 => array(),
313        'image_source'                               => array(),
314        'index'                                      => array(),
315        'intro_text'                                 => array( 'searchable_in_all_content' => true ),
316        'job_mention'                                => array( 'searchable_in_all_content' => true ),
317        'keywords'                                   => array( 'searchable_in_all_content' => true ),
318        'latest_news'                                => array(),
319        'layout'                                     => array(),
320        'link'                                       => array(),
321        'link_dump'                                  => array( 'searchable_in_all_content' => true ),
322        'link_url'                                   => array(),
323        'location'                                   => array(),
324        'logo'                                       => array(),
325        'main_title'                                 => array( 'searchable_in_all_content' => true ),
326        'maximum_entity_count'                       => array(),
327        'media'                                      => array(),
328        'mentions'                                   => array(),
329        'messages'                                   => array(),
330        'meta_description'                           => array( 'searchable_in_all_content' => true ),
331        'meta_id'                                    => array(),
332        'meta_index'                                 => array(),
333        'meta_key'                                   => array(),
334        'meta_value'                                 => array(),
335        'modal-dialog-id'                            => array(),
336        'name'                                       => array( 'searchable_in_all_content' => true ),
337        'nombre'                                     => array( 'searchable_in_all_content' => true ),
338        'notes'                                      => array( 'searchable_in_all_content' => true ),
339        'options'                                    => array(),
340        'order_by'                                   => array(),
341        'order_direction'                            => array(),
342        'original_cats'                              => array(),
343        'original_headers'                           => array(),
344        'original_link'                              => array(),
345        'original_message'                           => array(),
346        'original_subject'                           => array(),
347        'original_title'                             => array(),
348        'original_to'                                => array(),
349        'other_setting'                              => array(),
350        'page_canonical'                             => array(),
351        'page_layout'                                => array(),
352        'page_sidebar'                               => array(),
353        'page_tags'                                  => array(),
354        'panels_data'                                => array(),
355        'parking'                                    => array(),
356        'pdf_upload'                                 => array(),
357        'people_mentioned'                           => array(),
358        'photo'                                      => array(),
359        'play_time'                                  => array(),
360        'position'                                   => array(),
361        'post-rating'                                => array(),
362        'post_background'                            => array(),
363        'post_color'                                 => array(),
364        'post_sidebar'                               => array(),
365        'post_subtitle'                              => array( 'searchable_in_all_content' => true ),
366        'price'                                      => array(),
367        'publication'                                => array(),
368        'rating'                                     => array(),
369        'ratings_average'                            => array(),
370        'ratings_score'                              => array(),
371        'ratings_users'                              => array(),
372        'relation'                                   => array(),
373        'reply_to_header'                            => array(),
374        'required'                                   => array(),
375        'returns'                                    => array(),
376        'review_post'                                => array(),
377        'rule'                                       => array(),
378        'section'                                    => array( 'searchable_in_all_content' => true ),
379        'selected_links'                             => array(),
380        'session_transcript'                         => array(),
381        'settings'                                   => array(),
382        'sex'                                        => array(),
383        'shares_count'                               => array(),
384        'show_description'                           => array( 'searchable_in_all_content' => true ),
385        'show_page_title'                            => array(),
386        'show_notes'                                 => array(),
387        'show_notes_preview'                         => array(),
388        'side'                                       => array(),
389        'sidebar'                                    => array(),
390        'site'                                       => array(),
391        'situation'                                  => array(),
392        'slide_template'                             => array(),
393        'slug'                                       => array(),
394        'sortorder'                                  => array(),
395        'source'                                     => array(),
396        'start_date'                                 => array(),
397        'status'                                     => array(),
398        'styles'                                     => array(),
399        'subtitle'                                   => array( 'searchable_in_all_content' => true ),
400        'subtitulo'                                  => array(),
401        'success'                                    => array(),
402        'summary'                                    => array( 'searchable_in_all_content' => true ),
403        'synopsis'                                   => array( 'searchable_in_all_content' => true ),
404        'tel'                                        => array(),
405        'tema'                                       => array(),
406        'testimonial'                                => array(),
407        'testimonial_author'                         => array(),
408        'text_already_subscribed'                    => array(),
409        'text_error'                                 => array(),
410        'text_invalid_email'                         => array(),
411        'text_not_subscribed'                        => array(),
412        'text_required_field_missing'                => array(),
413        'text_subscribed'                            => array(),
414        'text_unsubscribed'                          => array(),
415        'thumbnail'                                  => array(),
416        'time'                                       => array(),
417        'time_jump_list'                             => array( 'searchable_in_all_content' => true ),
418        'title'                                      => array( 'searchable_in_all_content' => true ),
419        'title_view'                                 => array(),
420        'titre'                                      => array( 'searchable_in_all_content' => true ),
421        'titulo'                                     => array( 'searchable_in_all_content' => true ),
422        'to_header'                                  => array(),
423        'toc'                                        => array(),
424        'transcript'                                 => array( 'searchable_in_all_content' => true ),
425        'transport_uri'                              => array(),
426        'type'                                       => array(),
427        'url'                                        => array(),
428        'validation'                                 => array(),
429        'value'                                      => array(),
430        'values'                                     => array(),
431        'variation'                                  => array(),
432        'video'                                      => array(),
433        'video_type'                                 => array(),
434        'video_url'                                  => array(),
435        'videopress_guid'                            => array(),
436        'website'                                    => array(),
437        'weight'                                     => array(),
438        'year'                                       => array(),
439
440        // wp.com martketplace search - @see https://wp.me/pdh6GB-Ax#comment-2104
441        '_app_icon'                                  => array(),
442        '_featured_product_video'                    => array(),
443        'wpcom_marketplace_org_slug'                 => array(),
444        '_wc_general_product_dependency_theme'       => array(),
445        '_wc_general_product_dependency_plugin'      => array(),
446        'wpcom_marketplace_product_extra_fields'     => array(),
447        'wccom_product_search_keywords'              => array( 'searchable_in_all_content' => true ),
448        '_wccom_product_faqs'                        => array( 'searchable_in_all_content' => true ),
449        'wccom_product_features'                     => array( 'searchable_in_all_content' => true ),
450        'wccom_product_compatibility'                => array( 'searchable_in_all_content' => true ),
451
452    ); // end indexed post meta.
453
454    /**
455     * Postmeta being considered for indexing
456     *   but currently not in the index
457     *   this list is really only for documentation.
458     *
459     * @static
460     * @access private
461     * @var array
462     */
463    private static $unindexed_postmeta = array(
464
465        // Core.
466        '_wp_attached_file'                          => array(),
467        '_wp_attachment_context'                     => array(),
468        '_wp_attachment_image_alt'                   => array(),
469        '_wp_attachment_is_custom_header'            => array(),
470        '_wp_attachment_metadata'                    => array(),
471        '_wp_desired_post_slug'                      => array(),
472        '_wp_old_date'                               => array(),
473        '_wp_old_slug'                               => array(),
474        '_wp_page_template'                          => array(),
475
476        // WooCommerce products.
477        // See https://github.com/woocommerce/woocommerce/blob/8ed6e7436ff87c2153ed30edd83c1ab8abbdd3e9/includes/data-stores/class-wc-product-data-store-cpt.php#L21 .
478        '_backorders'                                => array(),
479        '_default_attributes'                        => array(),
480        '_download_expiry'                           => array(),
481        '_download_limit'                            => array(),
482        '_download_permissions_granted'              => array(),
483        '_downloadable_files'                        => array(),
484        '_file_paths'                                => array(),
485        '_manage_stock'                              => array(),
486        '_product_image_gallery'                     => array(),
487        '_purchase_note'                             => array(),
488        '_recorded_sales'                            => array(),
489        '_sold_individually'                         => array(),
490        '_stock'                                     => array(),
491        '_tax_class'                                 => array(),
492        '_tax_status'                                => array(),
493        '_thumbnail_id'                              => array(),
494        '_upsell_ids'                                => array(),
495        '_variation_description'                     => array(),
496        '_virtual'                                   => array(),
497        '_visibility'                                => array(),
498        'coupon_amount'                              => array(),
499        'default_source'                             => array(),
500        'discount_type'                              => array(),
501        'exclude_sale_items'                         => array(),
502        'expiry_date'                                => array(),
503
504        // Woocommerce orders and refunds.
505        // See https://github.com/woocommerce/woocommerce/blob/8ed6e7436ff87c2153ed30edd83c1ab8abbdd3e9/includes/data-stores/class-wc-order-data-store-cpt.php#L27 .
506        // See https://github.com/woocommerce/woocommerce/blob/b8a2815ae546c836467008739e7ff5150cb08e93/includes/data-stores/class-wc-order-refund-data-store-cpt.php#L20 .
507        '_billing_address_1'                         => array(),
508        '_billing_address_2'                         => array(),
509        '_billing_address_index'                     => array(),
510        '_billing_city'                              => array(),
511        '_billing_company'                           => array(),
512        '_billing_country'                           => array(),
513        '_billing_email'                             => array(),
514        '_billing_first_name'                        => array(),
515        '_billing_last_name'                         => array(),
516        '_billing_phone'                             => array(),
517        '_billing_postcode'                          => array(),
518        '_billing_state'                             => array(),
519        '_cart_discount'                             => array(),
520        '_cart_discount_tax'                         => array(),
521        '_completed_date'                            => array(),
522        '_created_via'                               => array(),
523        '_customer_ip_address'                       => array(),
524        '_customer_user_agent'                       => array(),
525        '_date_completed'                            => array(),
526        '_date_paid'                                 => array(),
527        '_order_currency'                            => array(),
528        '_order_key'                                 => array(),
529        '_order_shipping'                            => array(),
530        '_order_shipping_tax'                        => array(),
531        '_order_stock_reduced'                       => array(),
532        '_order_tax'                                 => array(),
533        '_order_total'                               => array(),
534        '_order_version'                             => array(),
535        '_paid_date'                                 => array(),
536        '_payment_method'                            => array(),
537        '_payment_method_title'                      => array(),
538        '_payment_tokens'                            => array(),
539        '_recorded_coupon_usage_counts'              => array(),
540        '_refund_amount'                             => array(),
541        '_refund_reason'                             => array(),
542        '_refunded_by'                               => array(),
543        '_shipping_address_1'                        => array(),
544        '_shipping_address_2'                        => array(),
545        '_shipping_address_index'                    => array(),
546        '_shipping_city'                             => array(),
547        '_shipping_company'                          => array(),
548        '_shipping_country'                          => array(),
549        '_shipping_first_name'                       => array(),
550        '_shipping_last_name'                        => array(),
551        '_shipping_postcode'                         => array(),
552        '_shipping_state'                            => array(),
553        '_transaction_id'                            => array(),
554
555        // aioseop.
556        '_aioseop_description'                       => array(),
557        '_aioseop_keywords'                          => array(),
558        '_aioseop_title'                             => array(),
559
560        // yoast.
561        '_yoast_wpseo_authorship'                    => array(),
562        '_yoast_wpseo_bctitle'                       => array(),
563        '_yoast_wpseo_canonical'                     => array(),
564        '_yoast_wpseo_content_score'                 => array(),
565        '_yoast_wpseo_focuskw'                       => array(),
566        '_yoast_wpseo_focuskw_text_input'            => array(),
567        '_yoast_wpseo_google-plus-description'       => array(),
568        '_yoast_wpseo_google-plus-image'             => array(),
569        '_yoast_wpseo_linkdex'                       => array(),
570        '_yoast_wpseo_meta-robots-adv'               => array(),
571        '_yoast_wpseo_meta-robots-nofollow'          => array(),
572        '_yoast_wpseo_meta-robots-noindex'           => array(),
573        '_yoast_wpseo_metadesc'                      => array(),
574        '_yoast_wpseo_metakeywords'                  => array(),
575        '_yoast_wpseo_opengraph-description'         => array(),
576        '_yoast_wpseo_opengraph-image'               => array(),
577        '_yoast_wpseo_opengraph-title'               => array(),
578        '_yoast_wpseo_primary_byline'                => array(),
579        '_yoast_wpseo_primary_category'              => array(),
580        '_yoast_wpseo_primary_product_cat'           => array(),
581        '_yoast_wpseo_primary_sponsor-type'          => array(),
582        '_yoast_wpseo_primary_tema_category'         => array(),
583        '_yoast_wpseo_primary_wpdmcategory'          => array(),
584        '_yoast_wpseo_primary_wt_portfolio_category' => array(),
585        '_yoast_wpseo_redirect'                      => array(),
586        '_yoast_wpseo_sitemap-include'               => array(),
587        '_yoast_wpseo_sitemap-prio'                  => array(),
588        '_yoast_wpseo_title'                         => array(),
589        '_yoast_wpseo_twitter-description'           => array(),
590        '_yoast_wpseo_twitter-image'                 => array(),
591
592        // bbpress.
593        'bbppu_read_by'                              => array(),
594        '_bbp_activity_id'                           => array(),
595        '_bbp_attachment'                            => array(),
596        '_bbp_attachment_upload_error'               => array(),
597        '_bbp_forum_id'                              => array(),
598        '_bbp_forum_parent_id'                       => array(),
599        '_bbp_forum_subforum_count'                  => array(),
600        '_bbp_forum_type'                            => array(),
601        '_bbp_group_ids'                             => array(),
602        '_bbp_last_active_id'                        => array(),
603        '_bbp_last_active_time'                      => array(),
604        '_bbp_last_reply_id'                         => array(),
605        '_bbp_last_topic_id'                         => array(),
606        '_bbp_old_forum_id'                          => array(),
607        '_bbp_old_sticky_status'                     => array(),
608        '_bbp_old_topic_id'                          => array(),
609        '_bbp_post_id'                               => array(),
610        '_bbp_reply_count'                           => array(),
611        '_bbp_reply_is_private'                      => array(),
612        '_bbp_reply_to'                              => array(),
613        '_bbp_revision_log'                          => array(),
614        '_bbp_status'                                => array(),
615        '_bbp_sticky_topics'                         => array(),
616        '_bbp_topic_count'                           => array(),
617        '_bbp_topic_id'                              => array(),
618        '_bbp_total_reply_count'                     => array(),
619        '_bbp_total_topic_count'                     => array(),
620        '_bbp_voice_count'                           => array(),
621
622        // ???
623        '_locale'                                    => array(),
624
625        // wp-job-manager.
626        '_job_title'                                 => array(),
627        '_job_description'                           => array(),
628
629        // wpml.
630        '_wpml_media_duplicate'                      => array(),
631        '_wpml_media_featured'                       => array(),
632
633        // generic fields.
634        'ad_clicks_count'                            => array(),
635        'email'                                      => array(),
636        'usage_count'                                => array(),
637        'user_mail'                                  => array(),
638        'views'                                      => array(),
639        '_EventAllDay'                               => array(),
640        '_EventCost'                                 => array(),
641        '_EventCurrencyPosition'                     => array(),
642        '_EventCurrencySymbol'                       => array(),
643        '_EventDuration'                             => array(),
644        '_EventEndDate'                              => array(),
645        '_EventEndDateUTC'                           => array(),
646        '_EventOrganizerID'                          => array(),
647        '_EventOrigin'                               => array(),
648        '_EventShowMap'                              => array(),
649        '_EventShowMapLink'                          => array(),
650        '_EventStartDate'                            => array(),
651        '_EventStartDateUTC'                         => array(),
652        '_EventTimezone'                             => array(),
653        '_EventTimezoneAbbr'                         => array(),
654        '_EventURL'                                  => array(),
655        '_EventVenueID'                              => array(),
656        '_OrganizerEmail'                            => array(),
657        '_OrganizerOrganizer'                        => array(),
658        '_OrganizerOrigin'                           => array(),
659        '_OrganizerPhone'                            => array(),
660        '_OrganizerWebsite'                          => array(),
661        '_VenueAddress'                              => array(),
662        '_VenueCity'                                 => array(),
663        '_VenueCountry'                              => array(),
664        '_VenueOrigin'                               => array(),
665        '_VenuePhone'                                => array(),
666        '_VenueProvince'                             => array(),
667        '_VenueShowMap'                              => array(),
668        '_VenueShowMapLink'                          => array(),
669        '_VenueState'                                => array(),
670        '_VenueStateProvince'                        => array(),
671        '_VenueURL'                                  => array(),
672        '_VenueVenue'                                => array(),
673        '_VenueVenueID'                              => array(),
674        '_VenueZip'                                  => array(),
675        '_description'                               => array(),
676        '_edit_last'                                 => array(),
677        '_feedback_all_fields'                       => array(),
678        '_feedback_author'                           => array(),
679        '_feedback_author_email'                     => array(),
680        '_feedback_author_url'                       => array(),
681        '_feedback_contact_form_url'                 => array(),
682        '_feedback_ip'                               => array(),
683        '_feedback_subject'                          => array(),
684        '_layout'                                    => array(),
685        '_links_to'                                  => array(),
686        '_links_to_target'                           => array(),
687        '_mail'                                      => array(),
688        '_mail_2'                                    => array(),
689        '_messages'                                  => array(),
690        '_numero'                                    => array(),
691        '_post_restored_from'                        => array(),
692        '_video_url'                                 => array(),
693        '_website'                                   => array(),
694
695    ); // end unindexed post meta.
696
697    /**
698     * List of indexed taxonomy slugs - VARCHAR(32)
699     *
700     * @access private
701     * @static
702     *
703     * @var array
704     */
705    private static $taxonomies_to_sync = array(
706
707        // Core.
708        'link_category',
709        'nav_menu',
710        'post_format', // Special, limited to certain values.
711
712        // bbpress.
713        'topic',
714        'topic-tag',
715        'topics',
716
717        // buddypress.
718        'bp-email-type',
719        'bp-email-type',
720        'bp_docs_access',
721        'bp_docs_associated_item',
722        'bp_docs_comment_access',
723        'bp_docs_doc_in_folder',
724        'bp_docs_folder_in_group',
725        'bp_docs_tag',
726        'bp_member_type',
727
728        // co-authors plus.
729        'author',
730
731        // events calendar plus.
732        // the events calendar.
733        'event-categories',
734        'event-category',
735        'event-tag',
736        'event-tags',
737        'event-type',
738        'event-venue',
739        'event_category',
740        'event_location',
741        'event_organizer',
742        'event_tag',
743        'event_type',
744        'event_type_2',
745        'event_users',
746        'events_categories',
747        'events_category',
748        'events_feeds',
749        'events_tags',
750        'tribe_events_cat',
751
752        // jetpack.
753        'jetpack-portfolio-tag',
754        'jetpack-portfolio-type',
755        'jetpack-search-tag0',
756        'jetpack-search-tag1',
757        'jetpack-search-tag2',
758        'jetpack-search-tag3',
759        'jetpack-search-tag4',
760        'jetpack-search-tag5',
761        'jetpack-search-tag6',
762        'jetpack-search-tag7',
763        'jetpack-search-tag8',
764        'jetpack-search-tag9',
765
766        // nextgen gallery.
767        'ngg_tag',
768
769        // polylang.
770        // wpml.
771        'language',
772        'post_translations',
773        'term_language',
774        'term_translations',
775        'translation_priority',
776
777        // woocommerce.
778        'documentation_category',
779        'pa_accessory-type',
780        'pa_actor',
781        'pa_age',
782        'pa_ambulance',
783        'pa_amount',
784        'pa_arm-roll',
785        'pa_aspectratio',
786        'pa_audiencerating',
787        'pa_author',
788        'pa_axle',
789        'pa_battery',
790        'pa_belakang',
791        'pa_binding',
792        'pa_body-type',
793        'pa_bore-x-stroke-mm',
794        'pa_box-cargo',
795        'pa_brakes',
796        'pa_brand',
797        'pa_brands',
798        'pa_bus',
799        'pa_c',
800        'pa_cabin-to-end',
801        'pa_capacity',
802        'pa_catalognumberlist',
803        'pa_ce-keurmerk',
804        'pa_chassis-front',
805        'pa_chassis-rear',
806        'pa_chassis-weight-kg',
807        'pa_chip-log',
808        'pa_clothing-size',
809        'pa_clutch',
810        'pa_clutch-type',
811        'pa_collection',
812        'pa_color',
813        'pa_colors',
814        'pa_colour',
815        'pa_compactor',
816        'pa_condition',
817        'pa_conditions-options',
818        'pa_cor',
819        'pa_couleur',
820        'pa_country',
821        'pa_countryregion-of-manufacture',
822        'pa_crane',
823        'pa_creator',
824        'pa_culoare',
825        'pa_customerpackagetype',
826        'pa_depan',
827        'pa_depan-belakang',
828        'pa_department',
829        'pa_design',
830        'pa_diameter',
831        'pa_diameter-cakram',
832        'pa_dimension-mm',
833        'pa_dimensions',
834        'pa_director',
835        'pa_disc-diameter',
836        'pa_drive-system',
837        'pa_dump',
838        'pa_ean',
839        'pa_eanlist',
840        'pa_edition',
841        'pa_electric-battery',
842        'pa_engine-model',
843        'pa_engine-size',
844        'pa_ethnicity',
845        'pa_exhaust-brake',
846        'pa_fabric',
847        'pa_farbe',
848        'pa_farg',
849        'pa_farge',
850        'pa_features',
851        'pa_final-gear-ratio',
852        'pa_finish',
853        'pa_fire-fighting',
854        'pa_fits',
855        'pa_flat-bed',
856        'pa_flavour',
857        'pa_format',
858        'pa_fragrance',
859        'pa_frame',
860        'pa_front',
861        'pa_front-overhang',
862        'pa_front-rear',
863        'pa_front-tread',
864        'pa_fuel-tank',
865        'pa_fuel-type',
866        'pa_garantie',
867        'pa_geadviseerd-accu-type',
868        'pa_gear-ratio',
869        'pa_gender',
870        'pa_genre',
871        'pa_gewicht-exclusief-accu',
872        'pa_gift-card-amount',
873        'pa_grade-ability-tan-o',
874        'pa_groesse',
875        'pa_gtin',
876        'pa_gvwr-gcwr',
877        'pa_hardwareplatform',
878        'pa_hazardousmaterialtype',
879        'pa_height',
880        'pa_hekmotor-of-boegmotor',
881        'pa_helmet-size',
882        'pa_hersteller',
883        'pa_high-blow-tank',
884        'pa_hoehe',
885        'pa_inhoud',
886        'pa_interchange-part-number',
887        'pa_isadultproduct',
888        'pa_isbn',
889        'pa_iseligiblefortradein',
890        'pa_itemdimensions',
891        'pa_itempartnumber',
892        'pa_kemudi-tipe',
893        'pa_kleur',
894        'pa_kopling-tipe',
895        'pa_label',
896        'pa_languages',
897        'pa_lbs',
898        'pa_legaldisclaimer',
899        'pa_lengte-aansluitkabel',
900        'pa_length',
901        'pa_liquid-tank',
902        'pa_location',
903        'pa_losse-motor-complete-set',
904        'pa_maat',
905        'pa_main-brake',
906        'pa_make',
907        'pa_manufacturer',
908        'pa_manufacturer-part-number',
909        'pa_manufacturermaximumage',
910        'pa_manufacturerminimumage',
911        'pa_manufacturerpartswarrantydesc',
912        'pa_masseinheit',
913        'pa_material',
914        'pa_mau-sac',
915        'pa_maximum-power-ps-rpm',
916        'pa_maximum-speed',
917        'pa_maximum-torque-kgm-rpm',
918        'pa_mediatype',
919        'pa_megethos',
920        'pa_merk',
921        'pa_metal-type',
922        'pa_min-turning-circle',
923        'pa_mixer',
924        'pa_model',
925        'pa_model-tipe',
926        'pa_model-type',
927        'pa_modelo',
928        'pa_mount',
929        'pa_mpn',
930        'pa_nicotine-strength',
931        'pa_nos-of-cylinder',
932        'pa_nos-of-tire',
933        'pa_numberofdiscs',
934        'pa_numberofitems',
935        'pa_numberofpages',
936        'pa_offset',
937        'pa_open-cargo',
938        'pa_operatingsystem',
939        'pa_options',
940        'pa_other-part-number',
941        'pa_overall-height',
942        'pa_overall-length',
943        'pa_overall-width',
944        'pa_overview',
945        'pa_packagedimensions',
946        'pa_packagequantity',
947        'pa_pages',
948        'pa_parking-brake',
949        'pa_part-number',
950        'pa_partnumber',
951        'pa_pattern',
952        'pa_pattern2',
953        'pa_performa',
954        'pa_pictureformat',
955        'pa_pin-size',
956        'pa_piston-displacement-cc',
957        'pa_ploshhad',
958        'pa_plug-type',
959        'pa_power',
960        'pa_product',
961        'pa_productgroup',
962        'pa_producttypename',
963        'pa_publicationdate',
964        'pa_publisher',
965        'pa_quantity',
966        'pa_rear',
967        'pa_rear-overhang',
968        'pa_rear-tread',
969        'pa_refrigerated-box',
970        'pa_region',
971        'pa_regioncode',
972        'pa_releasedate',
973        'pa_rem-parkir',
974        'pa_rem-pelambat',
975        'pa_rem-utama',
976        'pa_reverse',
977        'pa_runningtime',
978        'pa_scent',
979        'pa_schachtlengte',
980        'pa_seeds',
981        'pa_series',
982        'pa_setting',
983        'pa_sex',
984        'pa_shape',
985        'pa_shirt-size',
986        'pa_size',
987        'pa_sizes',
988        'pa_sku',
989        'pa_sky-lift',
990        'pa_sleeve-length',
991        'pa_snelheidsregeling',
992        'pa_staart',
993        'pa_steering',
994        'pa_steering-type',
995        'pa_storlek',
996        'pa_studio',
997        'pa_stuwkracht-lbs',
998        'pa_style',
999        'pa_suspensions',
1000        'pa_taille',
1001        'pa_talla',
1002        'pa_tamanho',
1003        'pa_tamano',
1004        'pa_taxi',
1005        'pa_ticket-type',
1006        'pa_tire-size',
1007        'pa_total-chassis-weight',
1008        'pa_towing-truck',
1009        'pa_tradeinvalue',
1010        'pa_trailer-t-head',
1011        'pa_transmisi-tipe',
1012        'pa_transmission',
1013        'pa_transmission-type',
1014        'pa_types',
1015        'pa_ukuran',
1016        'pa_upc',
1017        'pa_upclist',
1018        'pa_variation',
1019        'pa_vehicle-carrier',
1020        'pa_vergelijkbaar-stuwkracht',
1021        'pa_vermogen',
1022        'pa_voltage',
1023        'pa_volume',
1024        'pa_warranty',
1025        'pa_weight',
1026        'pa_wheel-base',
1027        'pa_wheel-configuration',
1028        'pa_wheel-disc-size',
1029        'pa_width',
1030        'pa_zout-water-geschikt',
1031        'product',
1032        'product-brand',
1033        'product_brand',
1034        'product-category',
1035        'product_cat',
1036        'product_delivery_time',
1037        'product_delivery_times',
1038        'product_price_label',
1039        'product_sale_labels',
1040        'product_shipping_class',
1041        'product_tag',
1042        'product_type',
1043        'product_unit',
1044        'product_visibility',
1045        'products',
1046
1047        // wp-job-manager.
1048        'job-category',
1049        'job-location',
1050        'job-type',
1051        'job_cat',
1052        'job_category',
1053        'job_listing_category',
1054        'job_listing_label',
1055        'job_listing_region',
1056        'job_listing_tag',
1057        'job_listing_type',
1058        'job_salary',
1059        'job_tag',
1060        'job_type',
1061        'jobman_category',
1062        'jobpost_category',
1063        'jobpost_job_type',
1064        'jobpost_location',
1065        'resume_category',
1066        'resume_groups',
1067        'resume_job_type',
1068        'resume_job_type',
1069        'resume_languages',
1070        'resume_region',
1071        'resume_skill',
1072        'resume_specialities',
1073
1074        // generic.
1075        '_resource',
1076        'acadp_categories',
1077        'acadp_locations',
1078        'action-group',
1079        'activity',
1080        'actor',
1081        'actors',
1082        'ad-group',
1083        'adace-ad-group',
1084        'adace-sponsor',
1085        'additional_features',
1086        'adv_location',
1087        'advanced_ads_groups',
1088        'advert_category',
1089        'affcoups_coupon_category',
1090        'affcoups_coupon_type',
1091        'ai_log_context',
1092        'ai_log_level',
1093        'al_product-cat',
1094        'aol_ad_category',
1095        'aol_ad_location',
1096        'aol_ad_type',
1097        'aol_application_status',
1098        'area',
1099        'article-slug',
1100        'asgarosforum-category',
1101        'asgarosforum-usergroup',
1102        'attachment_category',
1103        'attachment_tag',
1104        'atum_location',
1105        'audience_type',
1106        'avhec_catgroup',
1107        'bartype',
1108        'baths',
1109        'beds',
1110        'bepro_listing_types',
1111        'blog_category',
1112        'booked_custom_calendars',
1113        'brand',
1114        'brands',
1115        'business',
1116        'business_cat',
1117        'business_category',
1118        'bwg_tag',
1119        'byline',
1120        'calendar_category',
1121        'calendar_feed',
1122        'calendar_type',
1123        'campaign_category',
1124        'campaign_tag',
1125        'carousel_cat',
1126        'carousels_category',
1127        'case27_job_listing_tags',
1128        'categories',
1129        'category_media',
1130        'category_portfolio',
1131        'celebrity_cat',
1132        'chapters',
1133        'chronosly_category',
1134        'city',
1135        'classified_listing_type',
1136        'client-types',
1137        'clients_groups',
1138        'cm-business-category',
1139        'cmdm_category',
1140        'cn_log_type',
1141        'coderevolution_post_source',
1142        'collection',
1143        'community',
1144        'companies',
1145        'company',
1146        'cont_category',
1147        'content_audit',
1148        'country',
1149        'course',
1150        'course-cat',
1151        'course-category',
1152        'course_cat',
1153        'course_category',
1154        'course_difficulty',
1155        'course_tag',
1156        'courses_type',
1157        'cp_campaign',
1158        'cp_recipe_category',
1159        'csco_post_featured',
1160        'ct_status',
1161        'ctl-stories',
1162        'cuisine',
1163        'dc_vendor_shop',
1164        'ddownload_category',
1165        'ddownload_tag',
1166        'dealstore',
1167        'department',
1168        'departments',
1169        'department-company',
1170        'developed-by',
1171        'dfads_group',
1172        'dgfw_gift_categories',
1173        'director',
1174        'district',
1175        'dlm_download_category',
1176        'dlm_download_tag',
1177        'doc_tag',
1178        'document-category',
1179        'document-type',
1180        'download_artist',
1181        'download_category',
1182        'download_tag',
1183        'downloads_filter',
1184        'dps_book',
1185        'dt_gallery_category',
1186        'dt_logos_category',
1187        'dt_portfolio_category',
1188        'dt_team_category',
1189        'dt_testimonials_category',
1190        'dtcast',
1191        'dtcreator',
1192        'dtdirector',
1193        'dtnetworks',
1194        'dtstudio',
1195        'dtyear',
1196        'dvteamtaxonomy',
1197        'dwqa-question_category',
1198        'dwqa-question_tag',
1199        'eafl_category',
1200        'easy-testimonial-category',
1201        'ecwd_event_category',
1202        'edd_log_type',
1203        'edition',
1204        'ef_editorial_meta',
1205        'ef_usergroup',
1206        'element_category',
1207        'elementor_library_type',
1208        'employees_category',
1209        'encyclopedia-tag',
1210        'envira-tag',
1211        'epkb_post_type_1_category',
1212        'espresso_event_categories',
1213        'espresso_event_type',
1214        'essential_grid_category',
1215        'et_post_format',
1216        'faq-group',
1217        'faq-tags',
1218        'faq-topic',
1219        'faq_cat',
1220        'faq_categories',
1221        'faq_category',
1222        'faqs-category',
1223        'fdm-menu-section',
1224        'feature',
1225        'featured_item_category',
1226        'featured_item_tag',
1227        'feedback_type',
1228        'feeds',
1229        'fl-builder-template-type',
1230        'flamingo_inbound_channel',
1231        'follow_up_email_campaign',
1232        'follow_up_email_type',
1233        'following_users',
1234        'football-team-taxo',
1235        'fpd_design_category',
1236        'gallery-category',
1237        'gallery_cat',
1238        'gallery_categories',
1239        'gallery_category',
1240        'gallery_entries',
1241        'gallerycat',
1242        'gd_event_tags',
1243        'gd_eventcategory',
1244        'gd_place_tags',
1245        'gd_placecategory',
1246        'genre',
1247        'genres',
1248        'gg_connect_hub',
1249        'give_log_type',
1250        'gn-genre',
1251        'gn-location-1',
1252        'gn-location-2',
1253        'gn-location-3',
1254        'gp_hubs',
1255        'gp_portfolios',
1256        'gp_videos',
1257        'group',
1258        'group-documents-category',
1259        'groups',
1260        'guest',
1261        'hashtags',
1262        'hotel_facility',
1263        'ia_invited_groups',
1264        'ia_invitees',
1265        'incsub_wiki_category',
1266        'industry',
1267        'ingredient',
1268        'insight-type',
1269        'issue',
1270        'issuem_issue',
1271        'issuem_issue_tags',
1272        'jbp_category',
1273        'karma-slider-category',
1274        'klaviyo_shop_cart_status',
1275        'kwlogos-carousel',
1276        'layout_category',
1277        'layout_type',
1278        'ld_course_category',
1279        'ld_course_tag',
1280        'ld_lesson_category',
1281        'ld_lesson_tag',
1282        'ld_topic_tag',
1283        'lesson-tag',
1284        'level',
1285        'lingotek_hash',
1286        'lingotek_profile',
1287        'link_library_category',
1288        'linkage',
1289        'list-tags',
1290        'listing-category',
1291        'listing_amenities',
1292        'listing_category',
1293        'liveblog',
1294        'llms_access_plan_visibility',
1295        'llms_product_visibility',
1296        'localisation',
1297        'location',
1298        'location-tag',
1299        'locations',
1300        'magazine',
1301        'map_location_categories',
1302        'masonry_gallery_category',
1303        'mc-event-category',
1304        'mec_category',
1305        'mec_location',
1306        'mec_organizer',
1307        'media-category',
1308        'media-tags',
1309        'media_category',
1310        'media_folder',
1311        'member_cat',
1312        'mentions',
1313        'mesh_template_types',
1314        'ml-slider',
1315        'module',
1316        'module-tag',
1317        'module_width',
1318        'movie_cat',
1319        'mpp-component',
1320        'mpp-status',
1321        'mpp-type',
1322        'muvicast',
1323        'muvicountry',
1324        'muvidirector',
1325        'muviindex',
1326        'muviquality',
1327        'muviyear',
1328        'news-category',
1329        'news-tag',
1330        'news-type',
1331        'news_type_cat',
1332        'news_category',
1333        'nova_menu',
1334        'nova_menu_item_label',
1335        'offer-types',
1336        'organization',
1337        'our_team_category',
1338        'page_category',
1339        'page_condition',
1340        'parisrestaurant',
1341        'parissauna',
1342        'partner_category',
1343        'partners',
1344        'paswdestinatari',
1345        'paypal_ipn_type',
1346        'pdf_lv_tag',
1347        'pec_events_category',
1348        'people',
1349        'people-department',
1350        'people-expertise',
1351        'people-location',
1352        'perfect_quotes_category',
1353        'performer',
1354        'person',
1355        'personnal-category',
1356        'pexcontentslider_category',
1357        'pexfullslider_category',
1358        'pexnivoslider_category',
1359        'pexpricing_category',
1360        'pexservice_category',
1361        'pextestimonial_category',
1362        'pf_feed_item_tag',
1363        'pg_sas_type',
1364        'photo_tag',
1365        'phototype',
1366        'pj-categs',
1367        'pj-tags',
1368        'pl-categs',
1369        'placement',
1370        'plan_status',
1371        'platform',
1372        'player',
1373        'plugins_categories',
1374        'podcast',
1375        'pojo_sidebars',
1376        'popup_category',
1377        'pornstars',
1378        'portada',
1379        'portcat',
1380        'portfolio-category',
1381        'portfolio-gallery',
1382        'portfolio-status',
1383        'portfolio-skills',
1384        'portfolio-tag',
1385        'portfolio-tags',
1386        'portfolio-type',
1387        'portfolio-types',
1388        'portfolio_cat',
1389        'portfolio_categories',
1390        'portfolio_category',
1391        'portfolio_cats',
1392        'portfolio_client',
1393        'portfolio_entries',
1394        'portfolio_filter',
1395        'portfolio_in',
1396        'portfolio_label',
1397        'portfolio_skills',
1398        'portfolio_tag',
1399        'portfolio_tags',
1400        'portfolio_type',
1401        'posicao',
1402        'post-type',
1403        'post_format',
1404        'post_series',
1405        'pp_editorial_meta',
1406        'pp_notify_role',
1407        'pp_usergroup',
1408        'pricingcats',
1409        'print_section',
1410        'print_status',
1411        'product_asset_class',
1412        'product_name',
1413        'programs',
1414        'project-attributes',
1415        'project-cat',
1416        'project-category',
1417        'project-type',
1418        'project_category',
1419        'project_collection',
1420        'project_tag',
1421        'projects_category',
1422        'projects_tag',
1423        'prominence',
1424        'promotion-categories',
1425        'property-city',
1426        'property-feature',
1427        'property-status',
1428        'property-type',
1429        'property-types',
1430        'property_action_category',
1431        'property_area',
1432        'property_category',
1433        'property_city',
1434        'property_feature',
1435        'property_status',
1436        'property_type',
1437        'province',
1438        'provinces',
1439        'publisher',
1440        'pwb-brand',
1441        'qmn_log_type',
1442        'qualification',
1443        'qualifications',
1444        'quality',
1445        'question-category',
1446        'question-tag',
1447        'question-type',
1448        'question_cat',
1449        'question_category',
1450        'question_tag',
1451        'quiz',
1452        'quiz-type',
1453        'quote_status',
1454        'rating',
1455        'reaction',
1456        'recipe-category',
1457        'recipe_category',
1458        'recipe_type',
1459        'region',
1460        'registrant-event',
1461        'related_keywords',
1462        'release-date',
1463        'resource-type',
1464        'resource_category',
1465        'resource_type',
1466        'resourcetype',
1467        'review-type',
1468        'review_category',
1469        'rodzaj',
1470        'role',
1471        'room_category',
1472        'room_tag',
1473        'roomtype',
1474        'rubriek_categorie',
1475        'savedreply',
1476        'schools',
1477        'scope',
1478        'scores_cat',
1479        'sdm_categories',
1480        'sdm_tags',
1481        'season',
1482        'secondary_html_features',
1483        'section',
1484        'sector',
1485        'series',
1486        'series_of_posts',
1487        'services_group',
1488        'serving',
1489        'shop_cart_status',
1490        'shop_cat',
1491        'shop_order_status',
1492        'shop_vendor',
1493        'shop_warranty_status',
1494        'shopp_category',
1495        'shopr_category',
1496        'show',
1497        'simple_link_category',
1498        'site-review-category',
1499        'sizes',
1500        'skill',
1501        'skill_level',
1502        'skills',
1503        'sld_cat',
1504        'slide-page',
1505        'slide-types',
1506        'slide_categories',
1507        'slide_type',
1508        'slider',
1509        'slider-locations',
1510        'slider_category',
1511        'slides_category',
1512        'slideshow',
1513        'sm-category',
1514        'snax_format',
1515        'sngg_media_tags',
1516        'solution_channel',
1517        'source_domain',
1518        'source_id',
1519        'sp_league',
1520        'sp_position',
1521        'sp_role',
1522        'sp_season',
1523        'sp_venue',
1524        'speaker',
1525        'speakers',
1526        'special-feature',
1527        'specialty',
1528        'spnl_log_type',
1529        'sponsor_categories',
1530        'sponsor_category',
1531        'sponsor_type',
1532        'spot_tag',
1533        'st_af_category',
1534        'st_af_tags',
1535        'staff',
1536        'staff-member-category',
1537        'staff-member-group',
1538        'staff_category',
1539        'staffgroups',
1540        'state',
1541        'status',
1542        'store',
1543        'stores',
1544        'studio',
1545        'study_level',
1546        'style',
1547        'style_category',
1548        'sub_transaction_action',
1549        'sub_transaction_result',
1550        'subcategory',
1551        'subject',
1552        'subscription_status',
1553        'swift-slider-category',
1554        'syn_sitegroup',
1555        'szbl-content-tag',
1556        'task-queue',
1557        'tax_feature',
1558        'tcb_symbols_tax',
1559        'tcp_product_category',
1560        'team',
1561        'team-category',
1562        'team_cat',
1563        'team_categories',
1564        'team_category',
1565        'team_cats',
1566        'team_department',
1567        'team_designation',
1568        'team_group',
1569        'team_member_position',
1570        'team_mfcategory',
1571        'teams',
1572        'tenant_categories',
1573        'tenant_location',
1574        'tender-category',
1575        'test-type',
1576        'testimonial-category',
1577        'testimonial-group',
1578        'testimonial-types',
1579        'testimonial_categories',
1580        'testimonial_category',
1581        'testimonials-category',
1582        'testimonials_category',
1583        'th_events_cat',
1584        'th_galleries_cat',
1585        'thegem_clients_sets',
1586        'thegem_news_sets',
1587        'thegem_portfolios',
1588        'thegem_quickfinders',
1589        'thegem_teams',
1590        'thegem_testimonials_sets',
1591        'theme',
1592        'themefusion_es_groups',
1593        'themes_categories',
1594        'themo_cpt_group',
1595        'themo_project_type',
1596        'themo_room_type',
1597        'thirstylink-category',
1598        'ticket_channel',
1599        'ticket_priority',
1600        'timeline_post_tag',
1601        'tipo',
1602        'tipologie',
1603        'tips',
1604        'tm-testimonials_category',
1605        'tm_testimonial_group',
1606        'tooltips_categories',
1607        'tour_category',
1608        'tour_destination',
1609        'tour_facility',
1610        'tour_phys',
1611        'tour_type',
1612        'tp_event_category',
1613        'transmission',
1614        'treatment-type',
1615        'tribe_events_cat',
1616        'truethemes-gallery-category',
1617        'tsas-category',
1618        'tshowcase-categories',
1619        'tsml_region',
1620        'ttshowcase_groups',
1621        'tvo_tags',
1622        'type',
1623        'types',
1624        'u_course_cat',
1625        'u_department',
1626        'u_event_cat',
1627        'ufaq-category',
1628        'ufaq-tag',
1629        'um_hashtag',
1630        'um_user_tag',
1631        'uncodeblock_category',
1632        'upg_cate',
1633        'urp-review-category',
1634        'us_portfolio_category',
1635        'us_testimonial_category',
1636        'user-group',
1637        'user_category',
1638        'user_status',
1639        'vendor',
1640        'venue',
1641        'video-category',
1642        'video-series',
1643        'video-tag',
1644        'video_category',
1645        'video_tag',
1646        'videos',
1647        'videos_categories',
1648        'voice_category',
1649        'vtmin_rule_category',
1650        'vtprd_rule_category',
1651        'w2dc-category',
1652        'w2dc-location',
1653        'w2dc-tag',
1654        'wcb_sponsor_level',
1655        'wcb_track',
1656        'wccf_checkout_field_field_type',
1657        'wccf_checkout_field_status',
1658        'wccf_order_field_field_type',
1659        'wccf_order_field_status',
1660        'wccf_product_field_field_type',
1661        'wccf_product_field_status',
1662        'wccf_product_prop_field_type',
1663        'wccf_product_prop_status',
1664        'wccf_user_field_field_type',
1665        'wccf_user_field_status',
1666        'wcfm_knowledgebase_category',
1667        'wcm_task_category',
1668        'wcpv_product_vendors',
1669        'wcs-instructor',
1670        'wcs-room',
1671        'wcs-type',
1672        'wdca_ad_categories',
1673        'webinar_type_cat',
1674        'where',
1675        'who',
1676        'wiki-category',
1677        'wiki_cats',
1678        'wl_entity_type',
1679        'workout_entries',
1680        'works-category',
1681        'wp-rest-api-log-method',
1682        'wp-rest-api-log-source',
1683        'wp-rest-api-log-status',
1684        'wp-type-activity-types',
1685        'wp-type-contacts-subtype',
1686        'wp-type-group',
1687        'wp_bannerize_tax',
1688        'wp_log_type',
1689        'wp_super_faq_category',
1690        'wpbdm-region',
1691        'wpbdp_category',
1692        'wpbdp_tag',
1693        'wpcm_make_model',
1694        'wpdmcategory',
1695        'wpfb_file_category',
1696        'wpfcas-category',
1697        'wpfd-category',
1698        'wplead_list_category',
1699        'wplss_logo_showcase_cat',
1700        'wpm-testimonial-category',
1701        'wpmf-category',
1702        'wpostahs-slider-category',
1703        'wprm_course',
1704        'wprm_cuisine',
1705        'wprm_ingredient',
1706        'wprm_keyword',
1707        'wprss_category',
1708        'wps_forum',
1709        'wpsc-variation',
1710        'wpsc_log_type',
1711        'wpsc_product_category',
1712        'wpseo_locations_category',
1713        'wpsisac_slider-category',
1714        'wpsl_store_category',
1715        'wpt_category',
1716        'wpt_result',
1717        'wpt_scale',
1718        'wpv_sermons_category',
1719        'wpvqgr_tag',
1720        'writer',
1721        'wyz_business_category',
1722        'wyz_business_rating_category',
1723        'wyz_business_tag',
1724        'wzkb_category',
1725        'year',
1726        'years',
1727        'yith_product_brand',
1728        'yith_shop_vendor',
1729        'yst_prominent_words',
1730        'zipcode',
1731        'zoninator_zones',
1732        'zrf_field_group',
1733
1734        // End The Backlog  @see https://wp.me/p9MPsk-X0.
1735        'bill-status',
1736        'etb-audience',
1737        'etb-state',
1738        'etb-target',
1739        'etb-topic',
1740        'etb-year',
1741        'foia-response-status',
1742        'target-type',
1743        'timeline-pillar',
1744        'timeline-type',
1745
1746        // wp.com martketplace search - @see https://wp.me/pdh6GB-Ax#comment-2104
1747        'wpcom_marketplace_categories',
1748
1749        // wp.com a8c-support-theme taxonomies.
1750        'kb_category',
1751        'kb_tag',
1752
1753        // coolhunting.com
1754        'article-type',
1755
1756    ); // end taxonomies.
1757
1758    /**
1759     * List of options to sync
1760     *
1761     * @access private
1762     * @static
1763     *
1764     * @var array
1765     */
1766    private static $options_to_sync = array(
1767        'jetpack_search_ai_prompt_override',
1768        'jetpack_search_color_theme',
1769        'jetpack_search_result_format',
1770        'jetpack_search_default_sort',
1771        'jetpack_search_overlay_trigger',
1772        'jetpack_search_excluded_post_types',
1773        'jetpack_search_highlight_color',
1774        'jetpack_search_enable_sort',
1775        'jetpack_search_inf_scroll',
1776        'jetpack_search_show_powered_by',
1777        'jetpack_search_experience',
1778        'jetpack_search_ai_answers_enabled',
1779        'jetpack_search_suggestions_enabled',
1780        'jetpack_search_override_woocommerce_search_template',
1781        'reader_chat',
1782        'instant_search_enabled',
1783    ); // end options.
1784
1785    /*
1786     * Taxonomies we know don't sync.
1787     * See also sync/src/class-defaults.php
1788     *
1789     * 'network'
1790     * 'post_status'
1791     * 'product_cat'
1792     * 'tags'
1793     *
1794     */
1795
1796    //
1797    // Hooks into sync.
1798
1799    /**
1800     * Add Search post meta to the post meta whitelist.
1801     *
1802     * @param array $list Existing post meta whitelist.
1803     * @return array Updated post meta whitelist.
1804     */
1805    public function add_search_post_meta_whitelist( $list ) {
1806        return array_merge( $list, static::get_all_postmeta_keys() );
1807    }
1808
1809    /**
1810     * Add Search options to the options whitelist.
1811     *
1812     * @param array $list Existing options whitelist.
1813     * @return array Updated options whitelist.
1814     */
1815    public function add_search_options_whitelist( $list ) {
1816        return array_merge( $list, static::get_all_option_keys() );
1817    }
1818
1819    /**
1820     * Add AI Answer CPTs to the post types sync whitelist when AI Answers is enabled.
1821     *
1822     * @param array $list Existing post types whitelist.
1823     * @return array Updated whitelist.
1824     */
1825    public function add_ai_answer_post_types( $list ) {
1826        if ( ! apply_filters( 'jetpack_search_ai_answers_enabled', (bool) get_option( 'jetpack_search_ai_answers_enabled', false ) ) ) {
1827            return $list;
1828        }
1829        $list[] = 'wp_guideline';
1830        return $list;
1831    }
1832
1833    // Indexing functions for wp.com.
1834
1835    /**
1836     * Check whether a postmeta or taxonomy 'key' is in the indexable
1837     * list. This is called by the indexing code on wp.com to decide
1838     * whether to include something in the index.
1839     *
1840     * @static
1841     * @access public
1842     *
1843     * @param string $type Either 'postmeta' or 'taxonomy'.
1844     * @param string $key The postmeta key or taxonomy name.
1845     * @return boolean
1846     */
1847    public static function is_indexable( $type, $key ) {
1848        switch ( $type ) {
1849            case 'postmeta':
1850                return isset( self::$postmeta_to_sync[ $key ] );
1851            case 'taxonomy':
1852                return in_array( $key, self::$taxonomies_to_sync, true );
1853        }
1854        return false;
1855    }
1856
1857    /**
1858     *
1859     * Get the indexing spec for a postmeta key.
1860     *
1861     * @static
1862     * @access public
1863     *
1864     * @param string $key The postmeta key.
1865     * @return array The spec.
1866     */
1867    public static function get_postmeta_spec( $key ) {
1868        return self::$postmeta_to_sync[ $key ];
1869    }
1870
1871    /**
1872     * Get all post meta keys that get synced.
1873     *
1874     * @access public
1875     *
1876     * @return array List of post meta keys that get synced.
1877     */
1878    public static function get_all_postmeta_keys() {
1879        return array_keys( self::$postmeta_to_sync );
1880    }
1881
1882    /**
1883     * Get all option keys that get synced.
1884     *
1885     * @access public
1886     *
1887     * @return array List of option keys that get synced.
1888     */
1889    public static function get_all_option_keys() {
1890        return self::$options_to_sync;
1891    }
1892
1893    /**
1894     * Get all unindexed postmeta.
1895     *  This is mostly for testing.
1896     *
1897     * @access public
1898     *
1899     * @return array List of postmeta that are not synced.
1900     */
1901    public static function get_all_unindexed_postmeta_keys() {
1902        return array_keys( self::$unindexed_postmeta );
1903    }
1904
1905    /**
1906     * Get all taxonomies that get synced.
1907     *  This is mostly for testing.
1908     *
1909     * @access public
1910     *
1911     * @return array List of taxonomies that get synced.
1912     */
1913    public static function get_all_taxonomies() {
1914        return self::$taxonomies_to_sync;
1915    }
1916}