[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 18:45:49 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 | Resolution:
Keywords: close 2nd-opinion | Focuses: multisite
--------------------------------+------------------------------
Comment (by 5um17):
Replying to [comment:1 flixos90]:
> I don't think this is something we should take care of at this point.
Using `switch_to_blog()` switches the currently active site state/scope,
that includes the permalink structure. In my opinion, what you're
describing is expected. I'm curious what's the use-case for switching to
another site for receiving the permalink of the current post.
>
> I don't think we can reliably switch the current post when a site is
switched, also it would add (for most cases) unnecessary overhead to the
switching site process. Therefore I tend `wontfix` for this one.
I am sorry I think I did not explain the problem very well. And you only
replied to the post script. Here I am reporting two cases
1. Inconstancy of page and post URLs. (I did not test this with CPT)
2. A better solution when using `get_permalink()` without ID in MU.
The actual issue for which I marked this ticket as bug is a wrong
permalink structure or say wrong permalink. For example subsite has
default permalink and main site has `%postname%` then value is return in
subsite is `%postname%` format which leads to 404. On other hand if I am
on single page the URL is correct.
This is inconstancy!
The second one is kind of enhancement while using `get_permalink()`
without ID, WP really don't know what should be the return value. Because
global values are set to current blog query not the one I switched to.
So it can be better may be do not return the permalink at all without ID?
Because you switched to another blog and query is unknown. Just IMHO.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38305#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list