Make WordPress Core

Ticket #35609: 35609.patch

File 35609.patch, 1.0 KB (added by spacedmonkey, 8 years ago)
  • wp-includes/post.php

    diff --git a/wp-includes/post.php b/wp-includes/post.php
    index bb7e37a..8592c1f 100644
    a b function set_post_type( $post_id = 0, $post_type = 'post' ) { 
    16651665 * For all others, the 'publicly_queryable' value will be used.
    16661666 *
    16671667 * @since 4.4.0
     1668 * @since 4.5.0  Allow function to allow $post_type to be a string
    16681669 *
    1669  * @param object $post_type_object Post type object.
     1670 * @param  object|string $post_type Post type object or key of post type.
    16701671 * @return bool Whether the post type should be considered viewable.
    16711672 */
    1672 function is_post_type_viewable( $post_type_object ) {
    1673         return $post_type_object->publicly_queryable || ( $post_type_object->_builtin && $post_type_object->public );
     1673function is_post_type_viewable( $post_type ) {
     1674        if ( is_scalar( $post_type ) ) {
     1675                if ( post_type_exists( $post_type ) ) {
     1676                        $post_type = get_post_type_object( $post_type );
     1677                } else {
     1678                        return false;
     1679                }
     1680        }
     1681        return $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public );
    16741682}
    16751683
    16761684/**