Yoast\WP\SEO\Helpers
Post_Type_Helper::filter_included_post_types
Filters the post types that are included to be indexed.
Метод класса: Post_Type_Helper{}
Хуки из метода
Возвращает
Массив. The filtered post types that are included to be indexed.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->filter_included_post_types( $included_post_types );
- $included_post_types(массив) (обязательный)
- The post types that are included to be indexed.
Код Post_Type_Helper::filter_included_post_types() Post Type Helper::filter included post types Yoast 27.4
protected function filter_included_post_types( $included_post_types ) {
/**
* Filter: 'wpseo_indexable_forced_included_post_types' - Allows force including posts of a certain post
* type to be saved to the indexable table.
*
* @param array $included_post_types The currently included post types that indexables will be created for.
*/
$filtered_included_post_types = \apply_filters( 'wpseo_indexable_forced_included_post_types', $included_post_types );
if ( ! \is_array( $filtered_included_post_types ) ) {
// If the filter got misused, let's return the unfiltered array.
return \array_values( $included_post_types );
}
// Add sanity check to make sure everything is an actual post type.
foreach ( $filtered_included_post_types as $key => $post_type ) {
if ( ! \post_type_exists( $post_type ) ) {
unset( $filtered_included_post_types[ $key ] );
}
}
// `array_values`, to make sure that the keys are reset.
return \array_values( $filtered_included_post_types );
}