Hi @johannesdb
Before I dive into this, are you sure this problem is related to this plugin? Does the same thing happen when all other plugins are deactivated and you are running on a default theme?
I ask this because this plugin doesn’t modify the URL, it only registers a few plugin related keys for auto-removal which is handled by WordPress core.
Cheers, Jory
Hi @keraweb,
Thanks for the fast answer!
I have tried to disable only this plugin and then the urls are not changed. I can’t say if it interacts with another plugin on the site and that is the issue. But disabling the view as plugin always solves the issue.
If you want, send me mail to get access to a site where you can see the issue.
/Johannes
-
This reply was modified 2 years, 1 month ago by
johannesdb.
Hi @johannesdb
Just a quick test before and further debugging since I have an idea what would be the cause.
Could you disable this line? https://github.com/JoryHogeveen/view-admin-as/blob/master/ui/class-ui.php#L56
You can just comment it and it should be fine. (add “//” before it).
Let me know if this changes anything!
Cheers, Jory
Hi @keraweb,
sure! Just tried – no change :-/
However this is the culprit!
/**
* Compat with front and WP version lower than 4.2.0.
* @since 1.6.4
* @link https://developer.ww.wp.xz.cn/reference/functions/wp_admin_canonical_url/
*/
if ( ! is_admin() || ! VAA_API::validate_wp_version( '4.2' ) ) {
// $this->add_action( 'wp_head', array( $this, 'remove_query_args' ) );
}
When I uncomment that line, the url is not changed 🙂
Hi @johannesdb
You are absolutely right, this method is also run on the front-end since the default WordPress core handler only runs on the admin.
I’ve added a path to the next dev version that only runs this code if there is an actual removable get variable present in the URL (for reset purposes etc.)
Patch: https://github.com/JoryHogeveen/view-admin-as/commit/09be711b739ae205d8322c04b6347231283b60df
PR: https://github.com/JoryHogeveen/view-admin-as/pull/131
Let me know if this works for you!
Edit: Just sideinfo, it appears that your URL structure isn’t compatible with WP core query methods (in this case remove_query_arg or maybe esc_url).
Cheers, Jory
-
This reply was modified 2 years, 1 month ago by
Jory Hogeveen. Reason: Sideinfo
Hey @keraweb
cool! Thanks for the patch!
Yup, we are aware that our urls are not quite compatible with wordpress. But they are with the js-library that we use. And there are no good ways to make wordpress compatible urls, that contains arrays. So it is a trade off.
Do you know when the next release will be out?
Hi @johannesdb
Perfect, could you please confirm whether the patch works for you or not? If so, I will release a.s.a.p.!
Cheers, Jory
Hey @keraweb
sure 🙂 Tested and the patch works 😀
Awesome, since it’s almost weekend I’ve scheduled the release for next week 🙂
Cheers, Jory
Hi @johannesdb
Just a heads-up. The release has a bit of a delay as I’m trying to get unit tests up and running.
Rest assured that the nest release will include this patch anyway so your local patch will be fine in any case!
Cheers, Jory
Hi @keraweb
Just wanted to hear if there is any news about the update?
/Johannes
Hi @johannesdb
Thanks for the reminder, I’ve been absolutely swamped with work.
The release has been published just now!
Cheers, Jory
@keraweb best news for a weekend! Thanks! 🙂
hope you Will and can have a lovely weekend!