WordPress.org

Make WordPress Core

Opened 22 months ago

Last modified 9 months ago

#42970 new enhancement

Add a 'rest_nonce_action' filter to the REST API

Reported by: enlightenedpie Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: REST API Keywords: has-patch
Focuses: rest-api Cc:
PR Number:

Description

In the spirit of fully customizing the REST API, as I'm doing in my current application, some features (like the REST prefix) are customizable through filters, while the nonce name, or rather the rest nonce 'action', is not. 'wp_rest' is a bit generic and could easily have a 'rest_nonce_name' or 'rest_nonce_action' filter added in wp-includes/rest-api.php.

I believe in this regard that allowing alignment with user-defined namespaces and naming conventions would really further the extensibility of the WP REST API, especially in cases where pretty much every default (including default endpoints) are being disabled or overridden/overwritten. Thoughts?

Attachments (3)

rest-api.php (37.9 KB) - added by enlightenedpie 22 months ago.
Proposed change to rest-api.php (starts at line 780)
rest-api.diff (994 bytes) - added by enlightenedpie 22 months ago.
rest-api.php patch
rest-api.2.diff (986 bytes) - added by enlightenedpie 22 months ago.
rest-api.php patch

Download all attachments as: .zip

Change History (8)

@enlightenedpie
22 months ago

Proposed change to rest-api.php (starts at line 780)

#1 @schlessera
22 months ago

Welcome aboard, @enlightenedpie , and thanks for the ticket!

To suggest code changes, you should upload them in the form of a patch, not the entire source file that you modified.

You can find more information about patches here: https://make.wordpress.org/core/handbook/contribute/#patches

Also, feel free to stop by in the #core channel on the make.wordpress.org Slack team if you have questions about the process.

@enlightenedpie
22 months ago

rest-api.php patch

#2 @enlightenedpie
22 months ago

  • Keywords has-patch added

@schlessera Thank you for the heads up! Obvs my first time contributing. Patch submitted.

#3 @schlessera
22 months ago

@enlightenedpie No worries, we all start at some point.

There's something wonky with the alignment of your docblock (click on the patch name to see it). You should make sure you use tabs & spaces correctly. If you change the patch, you can just re-upload it and overwrite the previous version.

@enlightenedpie
22 months ago

rest-api.php patch

#4 @enlightenedpie
22 months ago

@schlessera Thank you, doc block fixed. Although, when I uploaded the new patch I didn't see a way to replace the old one.

#5 @pento
9 months ago

  • Version trunk deleted
Note: See TracTickets for help on using tickets.