Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to create route urls from admin to web/ajax or vice versa #28

Open
calvinalkan opened this issue May 12, 2021 · 0 comments
Open

Comments

@calvinalkan
Copy link

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)

  1. Create an admin route with the name admin.foo
  2. Create a menu page using add_menu_page with the slug of foo
  3. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant