Excluded post types not working anymore
-
Hello!
Recently, my client’s integration started to index post types which I have excluded with
algolia_excluded_post_types
.This is my snippet, which should exclude quite some things:
function mb_blacklist_custom_post_type( array $blacklist ) { $blacklist[] = 'employee'; $blacklist[] = 'book_review'; $blacklist[] = 'wp_template_part'; $blacklist[] = 'acf-field'; $blacklist[] = 'post'; $blacklist[] = 'wp_navigation'; $blacklist[] = 'wp_global_styles'; $blacklist[] = 'acf-field-group'; $blacklist[] = 'wp_template'; $blacklist[] = 'user_request'; $blacklist[] = 'oembed_cache'; $blacklist[] = 'customize_changeset'; $blacklist[] = 'custom_css'; $blacklist[] = 'attachment'; $blacklist[] = 'page'; $blacklist[] = 'wp_block'; $blacklist[] = 'users'; return $blacklist; } add_filter( 'algolia_excluded_post_types', 'mb_blacklist_custom_post_type' );
I tried outputting the
$excluded
-variable fromclass-algolia-settings.php
, which outputs the following:[19-Dec-2023 09:01:12 UTC] Excluded: [19-Dec-2023 09:01:12 UTC] Array ( [0] => nav_menu_item [1] => employee [2] => book_review [3] => wp_template_part [4] => acf-field [5] => post [6] => wp_navigation [7] => wp_global_styles [8] => acf-field-group [9] => wp_template [10] => user_request [11] => oembed_cache [12] => customize_changeset [13] => custom_css [14] => attachment [15] => page [16] => wp_block [17] => users [18] => revision [19] => custom_css [20] => customize_changeset [21] => oembed_cache [22] => user_request [23] => wp_block [24] => wp_global_styles [25] => wp_navigation [26] => wp_template [27] => wp_template_part [28] => kr_request_token [29] => kr_access_token [30] => deprecated_log [31] => async-scan-result [32] => scanresult )
This is before
array_unique()
, but as you can see,attachment
(14) andpage
(15) are in the list.However, whenever the index is running, it’s indexing all media files and all pages. It’s not indexing
employee
, because that post type has'exclude_from_search' => true,
.What could be the reason the
algolia_excluded_post_types
-function suddenly stopped working?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Excluded post types not working anymore’ is closed to new replies.