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

WP Admin Routes: Page parameter has to be first #70

Open
skylerfenn opened this issue Jul 27, 2020 · 0 comments
Open

WP Admin Routes: Page parameter has to be first #70

skylerfenn opened this issue Jul 27, 2020 · 0 comments

Comments

@skylerfenn
Copy link
Member

Problem

Admin routes are matched based on URL parameters. This is not very reliable because a match is only found when the page parameter is first.

For example,

With the route:

    $router->adminGet('calendars', [
        'uses'     => 'CalendarController@index',
        'as'       => 'calendar.index',
        'icon'     => 'dashicons-calendar-alt',
        'position' => 20,
    ]);

This URL will match the above route.
/cms/wp-admin/admin.php?page=calendars&id=boise

This URL will NOT match the above route.
/cms/wp-admin/admin.php?id=boise&page=calendars

Both should work.

Suggested Fix

Change the LaraPress UriValidator class to pull the page parameter first when checking for a WP Admin page match.

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