[wp-trac] [WordPress Trac] #16798: Admin bar edit action is affected by query_posts, tax_query

WordPress Trac wp-trac at lists.automattic.com
Tue Mar 8 19:09:01 UTC 2011


#16798: Admin bar edit action is affected by query_posts, tax_query
----------------------------+-----------------------------
 Reporter:  kanuck54        |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:  3.1
 Severity:  normal          |   Keywords:
----------------------------+-----------------------------
 I don't know if this part is a bug, but I'm guessing yes:

 If I run `query_posts()` in a custom post type's template, I lose the
 admin bar's "edit" action.

 This part, however, is definitely a bug:

 If I include a `tax_query` in my `query_posts()`, my edit link actually
 ''changes'' to an edit link for the last item in the array that was given
 to the `tax_query`, with the label "Edit Category."

 Here's the minimum offending code to reproduce, placed into a custom post
 type template:

 {{{
 query_posts( array(
         'post_type' => 'fp_toy',
         'tax_query' => array(
                 array(
                         'taxonomy' => 'fp_gender',
                         'field' => 'ID',
                         'terms' => array(14)
                 )
         ),
 ) );
 }}}

 Now my "Edit Toy" button says "Edit Category" instead, and points to
 `edit-tags.php?action=edit&taxonomy=fp_gender&tag_ID=14`.

 Ideally I would expect the admin bar's edit action to be unaffected by
 what happens inside the template. And I definitely don't expect a
 completely unrelated action to show up instead!

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16798>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list