WordPress.org

Make WordPress Core

Opened 22 months ago

Closed 6 weeks 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)

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

Download all attachments as: .zip

Change History (9)

johnbillion22 months ago

comment:1 johnbillion22 months 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.

comment:2 toscho22 months ago

  • Cc info@… added

comment:3 greenshady20 months ago

  • Cc justin@… added

comment:4 johnbillion7 weeks 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.

comment:5 ircbot7 weeks ago

This ticket was mentioned in IRC in #wordpress-dev by johnbillion. View the logs.

comment:6 johnbillion7 weeks 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.

comment:7 johnbillion7 weeks ago

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

Re-opening to update the Codex.

comment:8 nacin6 weeks ago

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