WordPress / WordPress/WordPress-Coding-Standards

Extra: sniff to check for usage of reserved words

Open
#871 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Extra Focus: Code analysis Focus: WP interoperability Type: Enhancement
Dominant language
PHP
Stars
2.8k
Forks
521
Avg merge
5d 20h
Merged PRs (30d)
1

Description

WordPress has a list of words which are reserved for use as query vars.
See: https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp.php#L18

If we can gather a list of functions in which these should not be used, I can imagine we could create a sniff to check against this.

One typical function in which they should not be used is register_taxonomy(), but I imagine there may be more functions in which these would lead to difficult to debug problems (with register_taxonomy() you end up with an unexplained 404).
Ref: https://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing WordPress's reserved query-variable list in class-wp.php and the register_taxonomy() documentation linked in the issue. Identify which functions are in scope before defining the sniff; done means the supported reserved terms and affected functions are agreed and the sniff's expected checks are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.