mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-21 14:05:11 +00:00
Allow is_post_type_viewable()
to accept a post type name.
Previously, it accepted only a post type object. Props spacedmonkey. Fixes #35609. Built from https://develop.svn.wordpress.org/trunk@36402 git-svn-id: http://core.svn.wordpress.org/trunk@36369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0d33e0904e
commit
de9d742b9a
@ -1665,12 +1665,20 @@ function set_post_type( $post_id = 0, $post_type = 'post' ) {
|
||||
* For all others, the 'publicly_queryable' value will be used.
|
||||
*
|
||||
* @since 4.4.0
|
||||
* @since 4.5.0 Added the ability to pass a post type name in addition to object.
|
||||
*
|
||||
* @param object $post_type_object Post type object.
|
||||
* @param object $post_type Post type name or object.
|
||||
* @return bool Whether the post type should be considered viewable.
|
||||
*/
|
||||
function is_post_type_viewable( $post_type_object ) {
|
||||
return $post_type_object->publicly_queryable || ( $post_type_object->_builtin && $post_type_object->public );
|
||||
function is_post_type_viewable( $post_type ) {
|
||||
if ( is_scalar( $post_type ) ) {
|
||||
$post_type = get_post_type_object( $post_type );
|
||||
if ( ! $post_type ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-alpha-36401';
|
||||
$wp_version = '4.5-alpha-36402';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
x
Reference in New Issue
Block a user