Skip to content

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

Description

@skylerfenn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions