[wp-trac] [WordPress Trac] #36529: Bug in get_permalink()

WordPress Trac noreply at wordpress.org
Fri Apr 15 03:29:59 UTC 2016


#36529: Bug in get_permalink()
----------------------------------------+------------------
 Reporter:  dav4                        |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  4.6
Component:  Permalinks                  |     Version:  4.5
 Severity:  normal                      |  Resolution:
 Keywords:  good-first-bug needs-patch  |     Focuses:
----------------------------------------+------------------

Comment (by SergeyBiryukov):

 Replying to [comment:4 Presskopp]:
 > I think the 36529.2 is a bit cleaner, using isset here

 [attachment:36529.1.patch] is a good start.

 * We should check `$default_category` there instead of `$category`.
 * `isset()` is redundant there, it would always be set.
 * `$category = ''` is also redundant, we already have that assignment in
 line 167 earlier.
 This should be enough:
 {{{
 if ( $default_category && ! is_wp_error( $default_category ) ) {
         $category = $default_category->slug;
 }
 }}}

 > What about other occurences of get_term() in connection with is_wp_error

 Good catch, let's fix the other instances too.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36529#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list