Permalinks: Avoid a PHP notice in `get_permalink()` if default category is unavailable.
Props Presskopp. Fixes #36529. git-svn-id: https://develop.svn.wordpress.org/trunk@37707 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2e79b18178
commit
57d2c46591
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue