WordPress.org

Make WordPress Core

Ticket #41981: 41981.patch

File 41981.patch, 744 bytes (added by JPry, 3 years ago)
  • src/wp-includes/link-template.php

    diff --git src/wp-includes/link-template.php src/wp-includes/link-template.php
    index eb22284ca3..9f51253cc1 100644
    function get_permalink( $post = 0, $leavename = false ) { 
    186186
    187187                                $category_object = get_term( $category_object, 'category' );
    188188                                $category = $category_object->slug;
    189                                 if ( $parent = $category_object->parent )
    190                                         $category = get_category_parents($parent, false, '/', true) . $category;
     189                                if ( $category_object->parent ) {
     190                                        $category = get_category_parents( $category_object->parent, false, '/', true ) . $category;
     191                                }
    191192                        }
    192193                        // show default category in permalinks, without
    193194                        // having to assign it explicitly