[wp-trac] [WordPress Trac] #16641: custom post has_archive in multisite

WordPress Trac wp-trac at lists.automattic.com
Thu Feb 24 15:36:46 UTC 2011


#16641: custom post has_archive in multisite
--------------------------+-----------------------------
 Reporter:  andreamk      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Post Types    |    Version:  3.1
 Severity:  major         |   Keywords:
--------------------------+-----------------------------
 has_archive flag in register_post_type only works on the main site

 in the subsite the error is
 Warning: Illegal offset type in isset or empty in .../wp-includes/post.php
 on line 812

 An the template redirect ad the file archive-{$post_type}.php don't work.

 I temporarily fixed by changing the function get_post_type_object

 {{{
 function get_post_type_object( $post_type ) {
         global $wp_post_types;

         if (is_array($post_type)) {
                 $post_type = $post_type[0];
         }

         if (empty($wp_post_types[$post_type]) )
                 return null;

         return $wp_post_types[$post_type];
 }
 }}}

 and using is_post_type_archive in file archive.php


 {{{
 <?php

 if (is_post_type_archive('my_post_type')) {
 require_once ('archive-my_post_type');
 return;
 }

 .
 .
 .

 }}}


 saw my bad English I struggle to explain better.

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


More information about the wp-trac mailing list