Permalinks: Avoid a PHP notice in `get_permalink()` if default category is unavailable.

Props Presskopp.
Fixes #36529.
Built from https://develop.svn.wordpress.org/trunk@37707


git-svn-id: http://core.svn.wordpress.org/trunk@37673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2016-06-14 23:12:28 +00:00
parent aad01818a5
commit 247e33934c
2 changed files with 4 additions and 2 deletions

View File

@ -191,7 +191,9 @@ function get_permalink( $post = 0, $leavename = false ) {
// having to assign it explicitly
if ( empty($category) ) {
$default_category = get_term( get_option( 'default_category' ), 'category' );
$category = is_wp_error( $default_category ) ? '' : $default_category->slug;
if ( $default_category && ! is_wp_error( $default_category ) ) {
$category = $default_category->slug;
}
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.6-alpha-37706';
$wp_version = '4.6-alpha-37707';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.