diff --git src/wp-includes/post.php src/wp-includes/post.php
index 10eee1d25f..ca39cd4daf 100644
|
|
function set_post_type( $post_id = 0, $post_type = 'post' ) { |
1972 | 1972 | * @since 4.4.0 |
1973 | 1973 | * @since 4.5.0 Added the ability to pass a post type name in addition to object. |
1974 | 1974 | * @since 4.6.0 Converted the `$post_type` parameter to accept a `WP_Post_Type` object. |
| 1975 | * @since 5.5.0 Added apply filter `post_type_viewable` to the result. |
1975 | 1976 | * |
1976 | 1977 | * @param string|WP_Post_Type $post_type Post type name or object. |
1977 | 1978 | * @return bool Whether the post type should be considered viewable. |
… |
… |
function is_post_type_viewable( $post_type ) { |
1984 | 1985 | } |
1985 | 1986 | } |
1986 | 1987 | |
1987 | | return $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public ); |
| 1988 | $is_viewable = $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public ); |
| 1989 | |
| 1990 | /** |
| 1991 | * Filter whether a post type is considered "viewable". |
| 1992 | * |
| 1993 | * @since 5.5.0 |
| 1994 | * |
| 1995 | * @param bool $is_viewable Whether the post type is "viewable". |
| 1996 | * @param WP_Post_Type $post_type Post type name or object. |
| 1997 | */ |
| 1998 | return apply_filters( 'post_type_viewable', $is_viewable, $post_type ); |
1988 | 1999 | } |
1989 | 2000 | |
1990 | 2001 | /** |