<?php /** * Rewrite API: WP_Rewrite class * * @package WordPress * @subpackage Rewrite * @since 1.5.0 */ /** * Core class used to implement a rewrite component API. * * The WordPress Rewrite class writes the rewrite module rules to the .htaccess * file. It also handles parsing the request to get the correct setup for the * WordPress Query class. * * The Rewrite along with WP class function as a front controller for WordPress. * You can add rules to trigger your page view and processing using this * component. The full functionality of a front controller does not exist, * meaning you can't define how the template files load based on the rewrite * rules. * * @since 1.5.0 */ #[AllowDynamicProperties] class WP_Rewrite { /** * Permalink structure for posts. * * @since 1.5.0 * @var string */ public $permalink_structure; /** * Whether to add trailing slashes. * * @since 2.2.0 * @var bool */ public $use_trailing_slashes; /** * Base for the author permalink structure (example.com/$author_base/authorname). * * @since 1.5.0 * @var string */ public $author_base = 'author'; /** * Permalink structure for author archives. * * @since 1.5.0 * @var string */ public $author_structure; /** * Permalink structure for date archives. * * @since 1.5.0 * @var string */ public $date_structure; /** * Permalink structure for pages. * * @since 1.5.0 * @var string */ public $page_structure; /** * Base of the search permalink structure (example.com/$search_base/query). * * @since 1.5.0 * @var string */ public $search_base = 'search'; /** * Permalink structure for searches. * * @since 1.5.0 * @var string */ public $search_structure; /** * Comments permalink base. * * @since 1.5.0 * @var string */ public $comments_base = 'comments'; /** * Pagination permalink base. * * @since 3.1.0 * @var string */ public $pagination_base = 'page'; /** * Comments pagination permalink base. * * @since 4.2.0 * @var string */ public $comments_pagination_base = 'comment-page'; /** * Feed permalink base. * * @since 1.5.0 * @var string */ public $feed_base = 'feed'; /** * Comments feed permalink structure. * * @since 1.5.0 * @var string */ public $comment_feed_structure; /** * Feed request permalink structure. * * @since 1.5.0 * @var string */ public $feed_structure; /** * The static portion of the post permalink structure. * * If the permalink structure is "/archive/%post_id%" then the front * is "/archive/". If the permalink structure is "/%year%/%postname%/" * then the front is "/". * * @since 1.5.0 * @var string * * @see WP_Rewrite::init() */ public $front; /** * The prefix for all permalink structures. * * If PATHINFO/index permalinks are in use then the root is the value of * `WP_Rewrite::$index` with a trailing slash appended. Otherwise the root * will be empty. * * @since 1.5.0 * @var string * * @see WP_Rewrite::init() * @see WP_Rewrite::using_index_permalinks() */ public $root = ''; /** * The name of the index file which is the entry point to all requests. * * @since 1.5.0 * @var string */ public $index = 'index.php'; /** * Variable name to use for regex matches in the rewritten query. * * @since 1.5.0 * @var string */ public $matches = ''; /** * Rewrite rules to match against the request to find the redirect or query. * * @since 1.5.0 * @var string[] */ public $rules; /** * Additional rules added external to the rewrite class. * * Those not generated by the class, see add_rewrite_rule(). * * @since 2.1.0 * @var string[] */ public $extra_rules = array(); /** * Additional rules that belong at the beginning to match first. * * Those not generated by the class, see add_rewrite_rule(). * * @since 2.3.0 * @var string[] */ public $extra_rules_top = array(); /** * Rules that don't redirect to WordPress' index.php. * * These rules are written to t