[wp-trac] [WordPress Trac] #20861: switch_to_blog() breaks custom post type permalinks
WordPress Trac
wp-trac at lists.automattic.com
Wed Jun 6 22:30:54 UTC 2012
#20861: switch_to_blog() breaks custom post type permalinks
--------------------------+-----------------------------
Reporter: sickhippie | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Multisite | Version: 3.3.2
Severity: normal | Keywords:
--------------------------+-----------------------------
When using switch_to_blog() and custom post types, there are very strange
results when calling the_permalink() or get_permalink(). For reference,
we'll say the root site is blog1 and the second site containing the posts
is blog2.
Using this code inside the loop:
{{{
switch_to_blog( $post->blog_id );
get_permalink();
}}}
If the post type is not registered on the current blog, the permalink
given will be sitename.com/blog2/slug - when clicking it as href, it
brings you the first instance of that slug in the database.
If the post type is registered on the current blog, the permalink given
will be sitename.com/blog2/blog1/post-type/slug - this link will 404.
Related issue: [http://core.trac.wordpress.org/ticket/14992/ 14992]
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20861>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list