[wp-trac] [WordPress Trac] #30669: Admin (edit.php). Wrong post type when using restrict_manage_posts for two taxonomies

WordPress Trac noreply at wordpress.org
Thu Dec 11 08:52:53 UTC 2014


#30669: Admin (edit.php). Wrong post type when using restrict_manage_posts for two
taxonomies
-------------------------------+-----------------------------
 Reporter:  axeleus            |      Owner:
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  4.0.1
 Severity:  normal             |   Keywords:
  Focuses:  administration     |
-------------------------------+-----------------------------
 I have custom post type "products" and two taxonomies (shoptag and
 shopcat).
 I create 2 dropdown menu


 {{{
   add_action( 'restrict_manage_posts', 'theme_restrict_manage_posts' );
   function theme_restrict_manage_posts() {

      global $typenow;

      if ($typenow == 'products') {

         $filters = array('shoptag', 'shopcat');

         foreach ($filters as $tax_slug) {
             $tax_obj = get_taxonomy($tax_slug);
             $tax_name = $tax_obj->labels->name;

             //echo dropdown
         }
      }
   }
 }}}

 When I chose "shoptag" and clicked the filter, I see the results page.
 Then I chose another option of dropdown, clicked filter and I saw Error:
 "Invalid record type".

 In wp-admin/edit.php at line 311

 {{{
 <input type="hidden" name="post_type" class="post_type_page" value="<?php
 echo $post_type; ?>" />
 }}}

 After manipulations described above in the "post_type" returned
 value="Array"

 I print the value "post_type" at line 161 we are see "Array ( [0] =>
 products )", but it should be "products". If we do to the same at line 159
 everything will be fine we are see "products".

 May be worth in the field "post_type" variable output $typenow at line
 311?


 {{{
 <input type="hidden" name="post_type" class="post_type_page" value="<?php
 echo $typenow; ?>" />
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30669>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list