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:
parent
aad01818a5
commit
247e33934c
|
@ -191,7 +191,9 @@ function get_permalink( $post = 0, $leavename = false ) {
|
||||||
// having to assign it explicitly
|
// having to assign it explicitly
|
||||||
if ( empty($category) ) {
|
if ( empty($category) ) {
|
||||||
$default_category = get_term( get_option( 'default_category' ), '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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue