[wp-trac] [WordPress Trac] #21219: get_post_type_archive_link in multisite context: struct issue

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 11 17:48:27 UTC 2012


#21219: get_post_type_archive_link in multisite context: struct issue
--------------------------+-----------------------------
 Reporter:  michelwppi    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Post Types    |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Context : multisite and a site aaa ( http://localhost/wpmu_svn_34/aaa/ )
 trying to display the '''post_type_archive_link''' of cpt 'book' of the
 blog bbb

 {{{
 switch_to_blog( $b );
 $link = get_post_type_archive_link( 'book' ) ;
 /*/ http://localhost/wpmu_svn_34/bbb/book/ and not
 http://localhost/wpmu_svn_34/bbb/livre/ */
 restore_current_blog();
 }}}

 when name, slug and query_var of the post_type are the same: no problem
 because $struct to find the '/book/' is kept from the caller site BUT

 if in the called site, the CPT have the same type name ('book') but with
 different slug and query_var, the home_url is correctly changed but the
 $struct is not good... 'book' instead 'livre' as declared in cpt in site
 bob.

 The issue came from global $wp_rewrite; which is not this of the target
 after the switch_to_blog !

 Instead of a non elegant filter ''post_type_archive_link'', is there a way
 to "find" the $wp_rewrite of $b ?

 Best regards !

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


More information about the wp-trac mailing list