[wp-trac] [WordPress Trac] #52882: get_term_link() WARNING

WordPress Trac noreply at wordpress.org
Mon Mar 22 16:15:47 UTC 2021


#52882: get_term_link() WARNING
--------------------------+-----------------------------
 Reporter:  Tkama         |       Owner:  SergeyBiryukov
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  5.8
Component:  Taxonomy      |     Version:  3.1
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * version:  5.7 => 3.1


Comment:

 Hi there, thanks for the report and the patch.

 I was able to reproduce the issue, but only when the taxonomy also has a
 custom permalink structure, either by calling `add_permastruct()` or using
 the `pre_term_link` filter. By default, `add_permastruct()` is only called
 for a taxonomy if the [source:tags/5.7/src/wp-includes/class-wp-
 taxonomy.php?marks=463,471#L454 `rewrite` argument is not false], which is
 the opposite of what's being reported here.

 Otherwise, the [source:tags/5.7/src/wp-
 includes/taxonomy.php?marks=4404#L4401
 $wp_rewrite->get_extra_permastruct()] call a few lines above returns
 `false` and the control gets into the [source:tags/5.7/src/wp-
 includes/taxonomy.php?marks=4419-4427#L4401 first conditional branch], and
 not the one that causes the warning.

 [attachment:"52882.diff"] includes a unit test.

 This is not new in 5.7 and appears to be introduced in [15824], adjusting
 the version accordingly.

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


More information about the wp-trac mailing list