Make WordPress Core

Opened 14 years ago

Closed 12 years ago

#20905 closed enhancement (fixed)

Allow rewrite endpoints to specify a different query variable name

Reported by: johnbillion Owned by: johnbillion
Priority: normal Milestone: 3.9
Component: Rewrite Rules Version:
Severity: normal Keywords: needs-codex
Cc: Focuses:

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 14 years ago.

Download all attachments as: .zip

Change History (9)

@johnbillion
14 years ago

#1 @johnbillion
14 years ago

  • 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.

#2 @toscho
14 years ago

  • Cc info@… added

#3 @greenshady
14 years ago

  • Cc justin@… added

#4 @johnbillion
12 years ago

  • Component PermalinksRewrite Rules
  • Keywords needs-codex commit added
  • Milestone Awaiting Review3.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.


12 years ago

#6 @johnbillion
12 years ago

  • Owner set to johnbillion
  • Resolutionfixed
  • Status newclosed

In 27327:

Allow rewrite endpoints to specify a query variable name. Fixes #20905.

#7 @johnbillion
12 years ago

  • Keywords has-patch commit removed
  • Resolution fixed
  • Status closedreopened

Re-opening to update the Codex.

#8 @nacin
12 years ago

  • Resolutionfixed
  • Status reopenedclosed
Note: See TracTickets for help on using tickets.