Make WordPress Core

Ticket #49628: 49628.7.diff

File 49628.7.diff, 1.1 KB (added by peterwilsoncc, 3 years ago)
  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 91edacf76f..94f5b838e9 100644
    a b function is_post_type_viewable( $post_type ) { 
    21082108        /**
    21092109         * Filters whether a post type is considered "viewable".
    21102110         *
     2111         * To avoid the potential for type errors in PHP 8.1 or later, this filter
     2112         * must return a boolean true for the post type to be considered viewable.
     2113         *
     2114         * All other values (even truthy values) will result in the function
     2115         * is_post_type_viewable() returning false.
     2116         *
    21112117         * @since 5.9.0
    21122118         *
    21132119         * @param bool         $is_viewable Whether the post type is "viewable".
    21142120         * @param WP_Post_Type $post_type   Post type object.
    21152121         */
    2116         $is_viewable = apply_filters( 'is_post_type_viewable', $is_viewable, $post_type );
    2117 
    2118         // Make sure the filtered value is a boolean type before returning it.
    2119         if ( ! is_bool( $is_viewable ) ) {
    2120                 return false;
    2121         }
    2122 
    2123         return $is_viewable;
     2122        return true === apply_filters( 'is_post_type_viewable', $is_viewable, $post_type );
    21242123}
    21252124
    21262125/**