[wp-trac] [WordPress Trac] #15943: Custom Post Type not being set on MU with Custom Permalinks

WordPress Trac wp-trac at lists.automattic.com
Tue Dec 21 23:42:55 UTC 2010


#15943: Custom Post Type not being set on MU with Custom Permalinks
--------------------------+-----------------------------
 Reporter:  sterlo        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Developing a plugin,

 It sets a custom post type on init:
 {{{
       register_post_type(
         'staff_listing',
         array(
           'labels' => array(
             'name' => 'Staff Listings',
             'add_new_item' => 'Add a Staff Member',
             'new_item' => 'Staff Member',
             'add_new' => 'Add a Staff Member',
             'singular_name' => 'Staff Member'
           ),
           'public' => true,
           'publicly_queryable' => true,
           'show_in_nav_menus'  => false,
           'exclude_from_search' => false,
           'show_ui' => true,
           'hierarchical' => false,
           'rewrite' => array(
             'slug' => 'staff',
             'with_front' => false
           ),
           'query_var' => 'staff',
           'supports' => array(
             'title',
             'editor',
             'thumbnail',
             'comments',
             'revisions'
           )
         )
       );
 }}}

 If I add a staff member called "john doe" and then go to that on the front
 end - I expect to see this in $wp_query->query_vars:
 {{{
 [staff] => john-doe
 [post_type] => staff_listing
 [category_name] =>
 [name] => john-doe
 [is_404] =>
 [queried_object_id] => ###
 }}}

 (I replaced the ID with ### since it changes from one install to the
 other)

 That '''works''' on a standard WordPress 3.0.3 install.

 But does '''not work''' on a WordPress 3.0.3 MU install.

 The MU install gives me this:
 {{{
 [name] => john-doe
 [post_type] =>
 [category_name] => staff
 [is_404] => 1
 [is_singular] =>
 [queried_object_id] => 0
 }}}

 Both the permalinks on the MU and standard setup are set as follows:
 {{{
 /%category%/%postname%/
 }}}

 If I change the permalink structure on the MU site to the default
 structure - the problem goes away.

 The new URL is: ?staff=john-doe and it sets the following:
 {{{
 [staff] => john-doe
 [post_type] => staff_listing
 [name] => john-doe
 [category_name] =>
 [is_404] =>
 [queried_object_id] => ###
 }}}

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


More information about the wp-trac mailing list