[wp-trac] [WordPress Trac] #18722: Missing link to edit term objects of non-public taxonomy

WordPress Trac wp-trac at lists.automattic.com
Wed Nov 23 18:23:46 UTC 2011


#18722: Missing link to edit term objects of non-public taxonomy
--------------------------+---------------------
 Reporter:  johnbillion   |       Owner:  duck_
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  3.3
Component:  Taxonomy      |     Version:  3.1
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |
--------------------------+---------------------

Comment (by coffee2code):

 I think what @duck_ had there previously could be used with minor
 modification and without needing to revert to using the `$post_type`
 global again.

 Is [http://core.trac.wordpress.org/browser/trunk/wp-
 admin/includes/screen.php?rev=19385#L449 this line] too restrictive?  It's
 why the post_type couldn't be properly inferred.  Currently, it only
 attempts to consider `$_REQUEST['post_type']` for the post_type when
 `WP_Screen::get()` is called without an argument, which is essentially
 when `set_current_screen()` is called without an argument (i.e. for the
 current screen).

 In related AJAX calls, `set_current_screen()` is called with an argument
 explicitly indicating the screen context.  As such, `$hook_name` has a
 value and `$_REQUEST` is thus never consulted even though doing so would
 correctly set the post_type.  In the aforementioned line, simply setting
 it to `if ( true )` (or removing the if() from around the code it wraps)
 seems to work without notices.  See [attachment:18722.no-global.1.diff]
 for simple, minimal-change example (not intended as final patch).

 So regardless of the value of `$hook_name` in `WP_Screen::get()`, couldn't
 we continue with further checking `$_REQUEST` if `$post_type` isn't yet
 set?  See patch [attachment:18722.no-global.2.diff] which:

 * Removes use of global `$post_type` reintroduced in [19415]
 * Consults `$_REQUEST` only if `$post_type` or `$taxonomy` aren't set
 * Flattens two `switch()` blocks into one

 Perhaps better filed as a new enhancement ticket for 3.4?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18722#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list