Opened 12 years ago
Closed 11 years ago
#20905 closed enhancement (fixed)
Allow rewrite endpoints to specify a different query variable name
Reported by: | johnbillion | Owned by: | johnbillion |
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Rewrite Rules | Keywords: | needs-codex |
Focuses: | Cc: |
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)
Change History (9)
#4
@
11 years ago
- Component changed from Permalinks to Rewrite Rules
- Keywords needs-codex commit added
- Milestone changed from Awaiting Review to 3.9
Patch still applies cleanly to trunk. I'd like to get this in 3.9.
This ticket was mentioned in IRC in #wordpress-dev by johnbillion. View the logs.
11 years ago
#6
@
11 years ago
- Owner set to johnbillion
- Resolution set to fixed
- Status changed from new to closed
In 27327:
Note: See
TracTickets for help on using
tickets.
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.