Returns the public post types, which excludes nav_items and similar types.
Description
Attachments are also excluded. This includes custom post types with public = true.
Source
public function get_object_subtypes() {
$post_types = get_post_types( array( 'public' => true ), 'objects' );
unset( $post_types['attachment'] );
$post_types = array_filter( $post_types, 'is_post_type_viewable' );
/**
* Filters the list of post object sub types available within the sitemap.
*
* @since 5.5.0
*
* @param WP_Post_Type[] $post_types Array of registered post type objects keyed by their name.
*/
return apply_filters( 'wp_sitemaps_post_types', $post_types );
}
Hooks
- apply_filters( ‘wp_sitemaps_post_types’,
WP_Post_Type[] $post_types ) Filters the list of post object sub types available within the sitemap.
Changelog
Version | Description |
---|---|
5.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.