WPSEO_Option_Titles::get_allowed_post_types()
Retrieve a list of the allowed post types as breadcrumb parent for a taxonomy. Helper method for validation.
{@internal Don't make static as new types may still be registered.}}
Метод класса: WPSEO_Option_Titles{}
Хуков нет.
Возвращает
Строку[]
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_allowed_post_types();
Код WPSEO_Option_Titles::get_allowed_post_types() WPSEO Option Titles::get allowed post types Yoast 24.9
protected function get_allowed_post_types() { $allowed_post_types = []; /* * WPSEO_Post_Type::get_accessible_post_types() should *not* be used here. */ $post_types = get_post_types( [ 'public' => true ], 'objects' ); if ( get_option( 'show_on_front' ) === 'page' && get_option( 'page_for_posts' ) > 0 ) { $allowed_post_types[] = 'post'; } if ( is_array( $post_types ) && $post_types !== [] ) { foreach ( $post_types as $type ) { if ( WPSEO_Post_Type::has_archive( $type ) ) { $allowed_post_types[] = $type->name; } } } return $allowed_post_types; }