wpemerge
wpemerge copied to clipboard
Impossible to create route urls from admin to web/ajax or vice versa
Version
- WP Emerge: latest
- WordPress: 5.6
- PHP: 7.3
Expected behaviour
Trying to create a reverse route URL from a web route to an admin route is impossible and throws a Configuration Exception ( named route not found ).
Actual behaviour
Created a route to an admin page inside a web route creates an URL to that route.
Steps to reproduce (in case of a bug)
- Create an admin route with the name
admin.foo
- Create a menu page using
add_menu_page
with the slug offoo
- Create any web route that just returns this
return App::routeUrl('admin.foo')
See the error message.
Comments
It's clear why this happens. The admin routes are never loaded for a web request and web routes are not loaded for admin requests.
This makes sense from a performance point but I don't know whether losing the described functionality was intended or just an unknown side effect.