Make WordPress Core

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's profile johnbillion Owned by: johnbillion's profile 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)

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

Download all attachments as: .zip

Change History (9)

@johnbillion
12 years ago

#1 @johnbillion
12 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
12 years ago

  • Cc info@… added

#3 @greenshady
12 years ago

  • Cc justin@… added

#4 @johnbillion
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 @johnbillion
11 years ago

  • Owner set to johnbillion
  • Resolution set to fixed
  • Status changed from new to closed

In 27327:

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

#7 @johnbillion
11 years ago

  • Keywords has-patch commit removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Re-opening to update the Codex.

#8 @nacin
11 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.