[wp-trac] [WordPress Trac] #38305: wrong permalink structure return by get_permalink() when switching blog in WPMU
WordPress Trac
noreply at wordpress.org
Thu Oct 13 15:27:37 UTC 2016
#38305: wrong permalink structure return by get_permalink() when switching blog in
WPMU
--------------------------------+-----------------------------
Reporter: 5um17 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Networks and Sites | Version:
Severity: normal | Keywords:
Focuses: multisite |
--------------------------------+-----------------------------
I am on blog ID 2 and switch to blog ID 1 then calls `get_permalink()`
without an argument it returns permalink of current post of blog ID 2 and
with permalink structure of blog ID 1.
Example:-
{{{#!php
add_action('wp_footer', function(){
switch_to_blog(1);
echo get_permalink();
restore_current_blog();
});
}}}
The same does not happen with pages but happens with post.
PS: I am also concerned about return value. Why it is returning current
post of current blog? It is breaking the other plugins those are storing
the post IDs in their custom tables thus making a wrong join with invalid
post ID.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38305>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list