From 247e33934cda514d4f11a87c852c0a4ff058a2ec Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 14 Jun 2016 23:12:28 +0000 Subject: [PATCH] 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 --- wp-includes/link-template.php | 4 +++- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 0d06a3f9ca..164bcd905c 100644 --- a/wp-includes/link-template.php +++ b/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; + } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 9b6a63772c..f7543e03e8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.