Docs: Clarify and standardise on terminology used for rewrite rule endpoint masks.

See #51800

Built from https://develop.svn.wordpress.org/trunk@49670


git-svn-id: http://core.svn.wordpress.org/trunk@49393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2020-11-19 16:15:08 +00:00
parent aab7112b09
commit 792c53ac8c
3 changed files with 88 additions and 23 deletions

View File

@ -840,9 +840,23 @@ class WP_Rewrite {
* *
* @param string $permalink_structure The permalink structure. * @param string $permalink_structure The permalink structure.
* @param int $ep_mask Optional. Endpoint mask defining what endpoints are added to the structure. * @param int $ep_mask Optional. Endpoint mask defining what endpoints are added to the structure.
* Accepts `EP_NONE`, `EP_PERMALINK`, `EP_ATTACHMENT`, `EP_DATE`, `EP_YEAR`, * Accepts a mask of:
* `EP_MONTH`, `EP_DAY`, `EP_ROOT`, `EP_COMMENTS`, `EP_SEARCH`, `EP_CATEGORIES`, * - `EP_ALL`
* `EP_TAGS`, `EP_AUTHORS`, `EP_PAGES`, `EP_ALL_ARCHIVES`, and `EP_ALL`. * - `EP_NONE`
* - `EP_ALL_ARCHIVES`
* - `EP_ATTACHMENT`
* - `EP_AUTHORS`
* - `EP_CATEGORIES`
* - `EP_COMMENTS`
* - `EP_DATE`
* - `EP_DAY`
* - `EP_MONTH`
* - `EP_PAGES`
* - `EP_PERMALINK`
* - `EP_ROOT`
* - `EP_SEARCH`
* - `EP_TAGS`
* - `EP_YEAR`
* Default `EP_NONE`. * Default `EP_NONE`.
* @param bool $paged Optional. Whether archive pagination rules should be added for the structure. * @param bool $paged Optional. Whether archive pagination rules should be added for the structure.
* Default true. * Default true.
@ -1682,6 +1696,23 @@ class WP_Rewrite {
* *
* @param string $name Name of the endpoint. * @param string $name Name of the endpoint.
* @param int $places Endpoint mask describing the places the endpoint should be added. * @param int $places Endpoint mask describing the places the endpoint should be added.
* Accepts a mask of:
* - `EP_ALL`
* - `EP_NONE`
* - `EP_ALL_ARCHIVES`
* - `EP_ATTACHMENT`
* - `EP_AUTHORS`
* - `EP_CATEGORIES`
* - `EP_COMMENTS`
* - `EP_DATE`
* - `EP_DAY`
* - `EP_MONTH`
* - `EP_PAGES`
* - `EP_PERMALINK`
* - `EP_ROOT`
* - `EP_SEARCH`
* - `EP_TAGS`
* - `EP_YEAR`
* @param string|bool $query_var Optional. Name of the corresponding query variable. Pass `false` to * @param string|bool $query_var Optional. Name of the corresponding query variable. Pass `false` to
* skip registering a query_var for this endpoint. Defaults to the * skip registering a query_var for this endpoint. Defaults to the
* value of `$name`. * value of `$name`.
@ -1725,9 +1756,23 @@ class WP_Rewrite {
* @type bool $with_front Whether the structure should be prepended with `WP_Rewrite::$front`. * @type bool $with_front Whether the structure should be prepended with `WP_Rewrite::$front`.
* Default true. * Default true.
* @type int $ep_mask The endpoint mask defining which endpoints are added to the structure. * @type int $ep_mask The endpoint mask defining which endpoints are added to the structure.
* Accepts `EP_NONE`, `EP_PERMALINK`, `EP_ATTACHMENT`, `EP_DATE`, `EP_YEAR`, * Accepts a mask of:
* `EP_MONTH`, `EP_DAY`, `EP_ROOT`, `EP_COMMENTS`, `EP_SEARCH`, `EP_CATEGORIES`, * - `EP_ALL`
* `EP_TAGS`, `EP_AUTHORS`, `EP_PAGES`, `EP_ALL_ARCHIVES`, and `EP_ALL`. * - `EP_NONE`
* - `EP_ALL_ARCHIVES`
* - `EP_ATTACHMENT`
* - `EP_AUTHORS`
* - `EP_CATEGORIES`
* - `EP_COMMENTS`
* - `EP_DATE`
* - `EP_DAY`
* - `EP_MONTH`
* - `EP_PAGES`
* - `EP_PERMALINK`
* - `EP_ROOT`
* - `EP_SEARCH`
* - `EP_TAGS`
* - `EP_YEAR`
* Default `EP_NONE`. * Default `EP_NONE`.
* @type bool $paged Whether archive pagination rules should be added for the structure. * @type bool $paged Whether archive pagination rules should be added for the structure.
* Default true. * Default true.

View File

@ -7,112 +7,115 @@
*/ */
/** /**
* Endpoint Mask for default, which is nothing. * Endpoint mask that matches nothing.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
define( 'EP_NONE', 0 ); define( 'EP_NONE', 0 );
/** /**
* Endpoint Mask for Permalink. * Endpoint mask that matches post permalinks.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
define( 'EP_PERMALINK', 1 ); define( 'EP_PERMALINK', 1 );
/** /**
* Endpoint Mask for Attachment. * Endpoint mask that matches attachment permalinks.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
define( 'EP_ATTACHMENT', 2 ); define( 'EP_ATTACHMENT', 2 );
/** /**
* Endpoint Mask for date. * Endpoint mask that matches any date archives.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
define( 'EP_DATE', 4 ); define( 'EP_DATE', 4 );
/** /**
* Endpoint Mask for year * Endpoint mask that matches yearly archives.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
define( 'EP_YEAR', 8 ); define( 'EP_YEAR', 8 );
/** /**
* Endpoint Mask for month. * Endpoint mask that matches monthly archives.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
define( 'EP_MONTH', 16 ); define( 'EP_MONTH', 16 );
/** /**
* Endpoint Mask for day. * Endpoint mask that matches daily archives.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
define( 'EP_DAY', 32 ); define( 'EP_DAY', 32 );
/** /**
* Endpoint Mask for root. * Endpoint mask that matches the site root.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
define( 'EP_ROOT', 64 ); define( 'EP_ROOT', 64 );
/** /**
* Endpoint Mask for comments. * Endpoint mask that matches comment feeds.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
define( 'EP_COMMENTS', 128 ); define( 'EP_COMMENTS', 128 );
/** /**
* Endpoint Mask for searches. * Endpoint mask that matches searches.
*
* Note that this only matches a search at a "pretty" URL such as
* `/search/my-search-term`, not `?s=my-search-term`.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
define( 'EP_SEARCH', 256 ); define( 'EP_SEARCH', 256 );
/** /**
* Endpoint Mask for categories. * Endpoint mask that matches category archives.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
define( 'EP_CATEGORIES', 512 ); define( 'EP_CATEGORIES', 512 );
/** /**
* Endpoint Mask for tags. * Endpoint mask that matches tag archives.
* *
* @since 2.3.0 * @since 2.3.0
*/ */
define( 'EP_TAGS', 1024 ); define( 'EP_TAGS', 1024 );
/** /**
* Endpoint Mask for authors. * Endpoint mask that matches author archives.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
define( 'EP_AUTHORS', 2048 ); define( 'EP_AUTHORS', 2048 );
/** /**
* Endpoint Mask for pages. * Endpoint mask that matches pages.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
define( 'EP_PAGES', 4096 ); define( 'EP_PAGES', 4096 );
/** /**
* Endpoint Mask for all archive views. * Endpoint mask that matches all archive views.
* *
* @since 3.7.0 * @since 3.7.0
*/ */
define( 'EP_ALL_ARCHIVES', EP_DATE | EP_YEAR | EP_MONTH | EP_DAY | EP_CATEGORIES | EP_TAGS | EP_AUTHORS ); define( 'EP_ALL_ARCHIVES', EP_DATE | EP_YEAR | EP_MONTH | EP_DAY | EP_CATEGORIES | EP_TAGS | EP_AUTHORS );
/** /**
* Endpoint Mask for everything. * Endpoint mask that matches everything.
* *
* @since 2.1.0 * @since 2.1.0
*/ */
@ -308,6 +311,23 @@ function flush_rewrite_rules( $hard = true ) {
* *
* @param string $name Name of the endpoint. * @param string $name Name of the endpoint.
* @param int $places Endpoint mask describing the places the endpoint should be added. * @param int $places Endpoint mask describing the places the endpoint should be added.
* Accepts a mask of:
* - `EP_ALL`
* - `EP_NONE`
* - `EP_ALL_ARCHIVES`
* - `EP_ATTACHMENT`
* - `EP_AUTHORS`
* - `EP_CATEGORIES`
* - `EP_COMMENTS`
* - `EP_DATE`
* - `EP_DAY`
* - `EP_MONTH`
* - `EP_PAGES`
* - `EP_PERMALINK`
* - `EP_ROOT`
* - `EP_SEARCH`
* - `EP_TAGS`
* - `EP_YEAR`
* @param string|bool $query_var Name of the corresponding query variable. Pass `false` to skip registering a query_var * @param string|bool $query_var Name of the corresponding query variable. Pass `false` to skip registering a query_var
* for this endpoint. Defaults to the value of `$name`. * for this endpoint. Defaults to the value of `$name`.
*/ */

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.7-alpha-49669'; $wp_version = '5.7-alpha-49670';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.