WordPress.org

Make WordPress Core

Ticket #49628: 49628.diff

File 49628.diff, 1.2 KB (added by donmhico, 10 months ago)
  • src/wp-includes/post.php

    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' ) { 
    19721972 * @since 4.4.0
    19731973 * @since 4.5.0 Added the ability to pass a post type name in addition to object.
    19741974 * @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.
    19751976 *
    19761977 * @param string|WP_Post_Type $post_type Post type name or object.
    19771978 * @return bool Whether the post type should be considered viewable.
    function is_post_type_viewable( $post_type ) { 
    19841985                }
    19851986        }
    19861987
    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 );
    19881999}
    19892000
    19902001/**