From 792c53ac8ca38bc76e40b89a606644668994c3cb Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 19 Nov 2020 16:15:08 +0000 Subject: [PATCH] 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 --- wp-includes/class-wp-rewrite.php | 57 ++++++++++++++++++++++++++++---- wp-includes/rewrite.php | 52 ++++++++++++++++++++--------- wp-includes/version.php | 2 +- 3 files changed, 88 insertions(+), 23 deletions(-) diff --git a/wp-includes/class-wp-rewrite.php b/wp-includes/class-wp-rewrite.php index 6b5fc05fc8..e357593969 100644 --- a/wp-includes/class-wp-rewrite.php +++ b/wp-includes/class-wp-rewrite.php @@ -840,9 +840,23 @@ class WP_Rewrite { * * @param string $permalink_structure The permalink 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`, - * `EP_MONTH`, `EP_DAY`, `EP_ROOT`, `EP_COMMENTS`, `EP_SEARCH`, `EP_CATEGORIES`, - * `EP_TAGS`, `EP_AUTHORS`, `EP_PAGES`, `EP_ALL_ARCHIVES`, and `EP_ALL`. + * 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` * Default `EP_NONE`. * @param bool $paged Optional. Whether archive pagination rules should be added for the structure. * Default true. @@ -1682,6 +1696,23 @@ class WP_Rewrite { * * @param string $name Name of the endpoint. * @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 * skip registering a query_var for this endpoint. Defaults to the * value of `$name`. @@ -1725,9 +1756,23 @@ class WP_Rewrite { * @type bool $with_front Whether the structure should be prepended with `WP_Rewrite::$front`. * Default true. * @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`, - * `EP_MONTH`, `EP_DAY`, `EP_ROOT`, `EP_COMMENTS`, `EP_SEARCH`, `EP_CATEGORIES`, - * `EP_TAGS`, `EP_AUTHORS`, `EP_PAGES`, `EP_ALL_ARCHIVES`, and `EP_ALL`. + * 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` * Default `EP_NONE`. * @type bool $paged Whether archive pagination rules should be added for the structure. * Default true. diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index 1e239b0a1a..4a204c2601 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -7,112 +7,115 @@ */ /** - * Endpoint Mask for default, which is nothing. + * Endpoint mask that matches nothing. * * @since 2.1.0 */ define( 'EP_NONE', 0 ); /** - * Endpoint Mask for Permalink. + * Endpoint mask that matches post permalinks. * * @since 2.1.0 */ define( 'EP_PERMALINK', 1 ); /** - * Endpoint Mask for Attachment. + * Endpoint mask that matches attachment permalinks. * * @since 2.1.0 */ define( 'EP_ATTACHMENT', 2 ); /** - * Endpoint Mask for date. + * Endpoint mask that matches any date archives. * * @since 2.1.0 */ define( 'EP_DATE', 4 ); /** - * Endpoint Mask for year + * Endpoint mask that matches yearly archives. * * @since 2.1.0 */ define( 'EP_YEAR', 8 ); /** - * Endpoint Mask for month. + * Endpoint mask that matches monthly archives. * * @since 2.1.0 */ define( 'EP_MONTH', 16 ); /** - * Endpoint Mask for day. + * Endpoint mask that matches daily archives. * * @since 2.1.0 */ define( 'EP_DAY', 32 ); /** - * Endpoint Mask for root. + * Endpoint mask that matches the site root. * * @since 2.1.0 */ define( 'EP_ROOT', 64 ); /** - * Endpoint Mask for comments. + * Endpoint mask that matches comment feeds. * * @since 2.1.0 */ 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 */ define( 'EP_SEARCH', 256 ); /** - * Endpoint Mask for categories. + * Endpoint mask that matches category archives. * * @since 2.1.0 */ define( 'EP_CATEGORIES', 512 ); /** - * Endpoint Mask for tags. + * Endpoint mask that matches tag archives. * * @since 2.3.0 */ define( 'EP_TAGS', 1024 ); /** - * Endpoint Mask for authors. + * Endpoint mask that matches author archives. * * @since 2.1.0 */ define( 'EP_AUTHORS', 2048 ); /** - * Endpoint Mask for pages. + * Endpoint mask that matches pages. * * @since 2.1.0 */ define( 'EP_PAGES', 4096 ); /** - * Endpoint Mask for all archive views. + * Endpoint mask that matches all archive views. * * @since 3.7.0 */ 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 */ @@ -308,6 +311,23 @@ function flush_rewrite_rules( $hard = true ) { * * @param string $name Name of the endpoint. * @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 * for this endpoint. Defaults to the value of `$name`. */ diff --git a/wp-includes/version.php b/wp-includes/version.php index a2388c8509..fdd3e9a3f0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @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.