get_post_type_archive_link in multisite context: struct issue
|Reported by:||michelwppi||Owned by:|
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 !