Make WordPress Core

Ticket #49628: 49628.2.diff

File 49628.2.diff, 1.2 KB (added by deepaklalwani, 5 years ago)

Update filter and $post_type parameter description

  • src/wp-includes/post.php

    diff --git src/wp-includes/post.php src/wp-includes/post.php
    index c76381ce95..4c3e6f58e9 100644
    function set_post_type( $post_id = 0, $post_type = 'post' ) { 
    19731973 * @since 4.4.0
    19741974 * @since 4.5.0 Added the ability to pass a post type name in addition to object.
    19751975 * @since 4.6.0 Converted the `$post_type` parameter to accept a `WP_Post_Type` object.
     1976 * @since 5.5.0 Added apply filter `post_type_viewable` to the result.
    19761977 *
    19771978 * @param string|WP_Post_Type $post_type Post type name or object.
    19781979 * @return bool Whether the post type should be considered viewable.
    function is_post_type_viewable( $post_type ) { 
    19851986                }
    19861987        }
    19871988
    1988         return $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public );
     1989        $is_viewable = $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public );
     1990
     1991        /**
     1992         * Filters whether a post type is considered "viewable".
     1993         *
     1994         * @since 5.5.0
     1995         *
     1996         * @param bool         $is_viewable Whether the post type is "viewable".
     1997         * @param WP_Post_Type $post_type   Post type object.
     1998         */
     1999        return apply_filters( 'post_type_viewable', $is_viewable, $post_type );
    19892000}
    19902001
    19912002/**