Skip to content

Conversation

@joostdekeijzer
Copy link

Tested for WordPress setup:

  1. without permalinks (rule 9507144)
  2. With permalinks (rule 9507146)

The permalink setup now works for:

The developer info states the header should only be used in POST requests, so added that requirement.

@joostdekeijzer joostdekeijzer force-pushed the master branch 3 times, most recently from 9ae6871 to 2ed4f03 Compare October 24, 2025 11:00
@azurit
Copy link
Member

azurit commented Oct 24, 2025

@joostdekeijzer Can you fix errors? Thanks.

Lint Yaml: tests/regression/wordpress-rule-exclusions-plugin/9507144.yaml#L45
45:1025 [line-length] line too long (2752 > 1024 characters)

Lint Yaml: tests/regression/wordpress-rule-exclusions-plugin/9507144.yaml#L25 
25:1025 [line-length] line too long (1523 > 1024 characters)

@joostdekeijzer
Copy link
Author

@joostdekeijzer Can you fix errors? Thanks.

Lint Yaml: tests/regression/wordpress-rule-exclusions-plugin/9507144.yaml#L45
45:1025 [line-length] line too long (2752 > 1024 characters)

Lint Yaml: tests/regression/wordpress-rule-exclusions-plugin/9507144.yaml#L25 
25:1025 [line-length] line too long (1523 > 1024 characters)

Yes, I got a report from the workflow 😄

@joostdekeijzer
Copy link
Author

Thinking a bit more about this (while making my own installation support 3rd party plugins and custom development):

With this patch, in a WordPress install "without permalinks" (rule 9507144) any POST to the WordPress REST API may use the x-http-method-override while WordPress installations "with permalinks" (rule 9507146) there is only limited support (only core WordPress requests).

So:

  • rule 9507144 supports both core WordPress + any custom development or 3rd party
  • rule 9507146 only supports core WordPress as is implemented at this moment.

Wouldn't it be most logical to have both rules support the same REST API requests?

@EsadCetiner
Copy link
Member

@joostdekeijzer

With this patch, in a WordPress install "without permalinks" (rule 9507144) any POST to the WordPress REST API may use the x-http-method-override while WordPress installations "with permalinks" (rule 9507146) there is only limited support (only core WordPress requests).

This is just an unintended side effect of the rule. if you want to, add an extra chain rule for 9507144 to allow the rule for a handful of rest_routes you can see some of the other rules in the plugin to see how this is done.

@joostdekeijzer
Copy link
Author

I think I understand your "unintended side effect" argument.

But, so I don't have to add a custom rule to my config for every WordPress site I host, I would like rule 9507146 to have the same "side effect" 😄

- 9507146 without permalinks (was 9507144)
- 9507147 With permalinks (was 9507146)

1. Added test that REQUEST_METHOD *must be* POST
2. Added support for DELETE override
3. Added tests

Please note that the WordPress developer docs state that any WordPress API call may use the x-http-method-override-header (see https://developer.wordpress.org/rest-api/using-the-rest-api/global-parameters/#_method-or-x-http-method-override-header)

With current implementation eg. Custom Post Types are not supported.
@joostdekeijzer
Copy link
Author

Updated due to fb32c34 renumbering.

@EsadCetiner
Copy link
Member

@joostdekeijzer

But, so I don't have to add a custom rule to my config for every WordPress site I host, I would like rule 9507146 to have the same "side effect" 😄

I understand the reasoning as to having the rules a bit laxer to allow for custom post types, can you open another PR for that?

But this won't mean that we're supporting 3rd party plugins, we don't have the manpower to maintain and test all of these 3rd party plugins.

Co-authored-by: Esad Cetiner <104706115+EsadCetiner@users.noreply.github.com>
@joostdekeijzer
Copy link
Author

@EsadCetiner

I'll create another PR for relaxing the wp-json x-http-method-override rule after this PR (so they don't interfere).

And I really do understand you don't want to open a door to supporting 3rd party plugins.

@EsadCetiner thanks for the hints/suggestions. I get a linter error for rule 9507184 (around line 527) which I don't understand.
@EsadCetiner
Copy link
Member

@joostdekeijzer Looks ready to merge, ignore the failure from the syntax check workflow it's broken.

@airween Can you take a look at this https://github.com/coreruleset/wordpress-rule-exclusions-plugin/actions/runs/19062257393/job/54447882123?pr=96 valid syntax is being marked as invalid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants