WordPress.org

Make WordPress Core

Changeset 37707


Ignore:
Timestamp:
06/14/2016 11:11:33 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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

Props Presskopp.
Fixes #36529.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r37685 r37707  
    192192            if ( empty($category) ) {
    193193                $default_category = get_term( get_option( 'default_category' ), 'category' );
    194                 $category = is_wp_error( $default_category ) ? '' : $default_category->slug;
     194                if ( $default_category && ! is_wp_error( $default_category ) ) {
     195                    $category = $default_category->slug;
     196                }
    195197            }
    196198        }
Note: See TracChangeset for help on using the changeset viewer.