[wp-trac] [WordPress Trac] #37205: Shared term's edit screen is inaccessible

WordPress Trac noreply at wordpress.org
Sat Jul 16 15:54:34 UTC 2016


#37205: Shared term's edit screen is inaccessible
--------------------------+-----------------------------
 Reporter:  dlh           |       Owner:  boonebgorges
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  4.6
Component:  Taxonomy      |     Version:  4.5
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  administration
--------------------------+-----------------------------
Changes (by swissspidy):

 * keywords:  has-patch dev-feedback => has-patch


Comment:

 Thanks for pinging me!

 > The commit message suggests that the taxonomy context should be set in
 `WP_Screen`, but I don't fully understand how this is the case -
 `get_term()` doesn't reference the current screen anywhere.

 `wp-admin/admin.php` calls `set_current_screen()`, which in turn calls
 `WP_Screen::get()`. [36874] made sure that inside that method `$taxonomy`,
 `$post_type` and the screen ID are properly populated.

 > The fix suggested in [attachment:37205.2.diff] (which is too verbose -
 `$taxnow` falls back on 'post_tag', so is never empty) depends on the
 `?taxonomy` query arg being set when visiting term.php. This is in fact
 the case when coming from edit-tags.php, which I think is the main path
 into term.php.

 The `$taxonomy` variable inside `WP_Screen::get()` falls back to
 `post_tag`, but not `$taxnow`, which is being set in `wp-admin/admin.php`
 and defaults to an empty string.

 Therefore replacing `get_term( $tag_ID, '', OBJECT, 'edit' );` with
 `get_term( $tag_ID, $taxnow, OBJECT, 'edit' );` should be enough.
 Definitely makes sense to me.

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


More information about the wp-trac mailing list