Opened 12 months ago

Last modified 9 months ago

#20905 new enhancement

Allow rewrite endpoints to specify a different query variable name

Reported by: johnbillion Owned by:
Priority: normal Milestone: Awaiting Review
Component: Permalinks Version:
Severity: normal Keywords: has-patch
Cc: info@…, justin@…

Description

Using add_rewrite_endpoint() we can add an endpoint such as /foo/bar/ which maps to foo=bar. I'd like to be able to map an endpoint to a query variable of a different name. Currently the query variable name always matches the endpoint name.

Example: I'd like to use /p/{number} as a nice short endpoint for some custom functionality, but the 'p' query variable is used by core. I'd like to be able to map /p/3/ to my_query_var=3.

Attachments (1)

20905.patch (1.7 KB) - added by johnbillion 12 months ago.

Download all attachments as: .zip

Change History (4)

  • Keywords has-patch added

Patch which adds an optional third parameter to add_rewrite_endpoint() for specifying the name of the corresponding query variable. Defaults to the endpoint name.

  • Cc info@… added
  • Cc justin@… added
Note: See TracTickets for help on using tickets.