Yoast\WP\SEO\Helpers
Post_Type_Helper::get_accessible_post_types()
Returns an array with the accessible post types.
An accessible post type is a post type that is public and isn't set as no-index (robots).
Метод класса: Post_Type_Helper{}
Хуки из метода
Возвращает
Массив
. Array with all the accessible post_types.
Использование
$Post_Type_Helper = new Post_Type_Helper(); $Post_Type_Helper->get_accessible_post_types();
Код Post_Type_Helper::get_accessible_post_types() Post Type Helper::get accessible post types Yoast 22.4
public function get_accessible_post_types() { $post_types = \get_post_types( [ 'public' => true ] ); $post_types = \array_filter( $post_types, 'is_post_type_viewable' ); /** * Filter: 'wpseo_accessible_post_types' - Allow changing the accessible post types. * * @param array $post_types The public post types. */ $post_types = \apply_filters( 'wpseo_accessible_post_types', $post_types ); // When the array gets messed up somewhere. if ( ! \is_array( $post_types ) ) { return []; } return $post_types; }