diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index 0d06a3f9ca..164bcd905c 100644 --- a/src/wp-includes/link-template.php +++ b/src/wp-includes/link-template.php @@ -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; + } } }