[ Index ] |
WordPress Cross Reference |
[Source view] [Print] [Project Stats]
WordPress Rewrite API
File Size: | 2028 lines (61 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
WP_Rewrite:: (35 methods):
using_permalinks()
using_index_permalinks()
using_mod_rewrite_permalinks()
preg_index()
page_uri_index()
page_rewrite_rules()
get_date_permastruct()
get_year_permastruct()
get_month_permastruct()
get_day_permastruct()
get_category_permastruct()
get_tag_permastruct()
get_extra_permastruct()
get_author_permastruct()
get_search_permastruct()
get_page_permastruct()
get_feed_permastruct()
get_comment_feed_permastruct()
add_rewrite_tag()
generate_rewrite_rules()
generate_rewrite_rule()
rewrite_rules()
wp_rewrite_rules()
mod_rewrite_rules()
iis7_url_rewrite_rules()
add_rule()
add_external_rule()
add_endpoint()
add_permastruct()
flush_rules()
init()
set_permalink_structure()
set_category_base()
set_tag_base()
__construct()
Class: WP_Rewrite - X-Ref
WordPress Rewrite Component.using_permalinks() X-Ref |
Whether permalinks are being used. This can be either rewrite module or permalink in the HTTP query string. return: bool True, if permalinks are enabled. |
using_index_permalinks() X-Ref |
Whether permalinks are being used and rewrite module is not enabled. Means that permalink links are enabled and index.php is in the URL. return: bool |
using_mod_rewrite_permalinks() X-Ref |
Whether permalinks are being used and rewrite module is enabled. Using permalinks and index.php is not in the URL. return: bool |
preg_index($number) X-Ref |
Index for matches for usage in preg_*() functions. The format of the string is, with empty matches property value, '$NUM'. The 'NUM' will be replaced with the value in the $number parameter. With the matches property not empty, the value of the returned string will contain that value of the matches property. The format then will be '$MATCHES[NUM]', with MATCHES as the value in the property and NUM the value of the $number parameter. param: int $number Index number. return: string |
page_uri_index() X-Ref |
Retrieve all page and attachments for pages URIs. The attachments are for those that have pages as parents and will be retrieved. return: array Array of page URIs as first element and attachment URIs as second element. |
page_rewrite_rules() X-Ref |
Retrieve all of the rewrite rules for pages. return: array |
get_date_permastruct() X-Ref |
Retrieve date permalink structure, with year, month, and day. The permalink structure for the date, if not set already depends on the permalink structure. It can be one of three formats. The first is year, month, day; the second is day, month, year; and the last format is month, day, year. These are matched against the permalink structure for which one is used. If none matches, then the default will be used, which is year, month, day. Prevents post ID and date permalinks from overlapping. In the case of post_id, the date permalink will be prepended with front permalink with 'date/' before the actual permalink to form the complete date permalink structure. return: bool|string False on no permalink structure. Date permalink structure. |
get_year_permastruct() X-Ref |
Retrieve the year permalink structure without month and day. Gets the date permalink structure and strips out the month and day permalink structures. return: bool|string False on failure. Year structure on success. |
get_month_permastruct() X-Ref |
Retrieve the month permalink structure without day and with year. Gets the date permalink structure and strips out the day permalink structures. Keeps the year permalink structure. return: bool|string False on failure. Year/Month structure on success. |
get_day_permastruct() X-Ref |
Retrieve the day permalink structure with month and year. Keeps date permalink structure with all year, month, and day. return: bool|string False on failure. Year/Month/Day structure on success. |
get_category_permastruct() X-Ref |
Retrieve the permalink structure for categories. If the category_base property has no value, then the category structure will have the front property value, followed by 'category', and finally '%category%'. If it does, then the root property will be used, along with the category_base property value. return: bool|string False on failure. Category permalink structure. |
get_tag_permastruct() X-Ref |
Retrieve the permalink structure for tags. If the tag_base property has no value, then the tag structure will have the front property value, followed by 'tag', and finally '%tag%'. If it does, then the root property will be used, along with the tag_base property value. return: bool|string False on failure. Tag permalink structure. |
get_extra_permastruct($name) X-Ref |
Retrieve extra permalink structure by name. param: string $name Permalink structure name. return: string|bool False if not found. Permalink structure string. |
get_author_permastruct() X-Ref |
Retrieve the author permalink structure. The permalink structure is front property, author base, and finally '/%author%'. Will set the author_structure property and then return it without attempting to set the value again. return: string|bool False if not found. Permalink structure string. |
get_search_permastruct() X-Ref |
Retrieve the search permalink structure. The permalink structure is root property, search base, and finally '/%search%'. Will set the search_structure property and then return it without attempting to set the value again. return: string|bool False if not found. Permalink structure string. |
get_page_permastruct() X-Ref |
Retrieve the page permalink structure. The permalink structure is root property, and '%pagename%'. Will set the page_structure property and then return it without attempting to set the value again. return: string|bool False if not found. Permalink structure string. |
get_feed_permastruct() X-Ref |
Retrieve the feed permalink structure. The permalink structure is root property, feed base, and finally '/%feed%'. Will set the feed_structure property and then return it without attempting to set the value again. return: string|bool False if not found. Permalink structure string. |
get_comment_feed_permastruct() X-Ref |
Retrieve the comment feed permalink structure. The permalink structure is root property, comment base property, feed base and finally '/%feed%'. Will set the comment_feed_structure property and then return it without attempting to set the value again. return: string|bool False if not found. Permalink structure string. |
add_rewrite_tag( $tag, $regex, $query ) X-Ref |
Add or update existing rewrite tags (e.g. %postname%). If the tag already exists, replace the existing pattern and query for that tag, otherwise add the new tag. param: string $tag Name of the rewrite tag to add or update. param: string $regex Regular expression to substitute the tag for in rewrite rules. param: string $query String to append to the rewritten query. Must end in '='. |
generate_rewrite_rules($permalink_structure, $ep_mask = EP_NONE, $paged = true, $feed = true, $forcomments = false, $walk_dirs = true, $endpoints = true) X-Ref |
Generate rewrite rules from a permalink structure. The main WP_Rewrite function for building the rewrite rule list. The contents of the function is a mix of black magic and regular expressions, so best just ignore the contents and move to the parameters. param: string $permalink_structure The permalink structure. param: int $ep_mask Endpoint mask defining what endpoints are added to the structure. Default is EP_NONE. param: bool $paged Should archive pagination rules be added for the structure? Default is true. param: bool $feed Should feed rewrite rules be added for the structure? Default is true. param: bool $forcomments Should the feed rules be a query for a comments feed? Default is false. param: bool $walk_dirs Should the 'directories' making up the structure be walked over and rewrite rules param: bool $endpoints Should endpoints be applied to the generated rewrite rules? Default is true. return: array Rewrite rule list. |
generate_rewrite_rule($permalink_structure, $walk_dirs = false) X-Ref |
Generate Rewrite rules with permalink structure and walking directory only. Shorten version of {@link WP_Rewrite::generate_rewrite_rules()} that allows for shorter list of parameters. See the method for longer description of what generating rewrite rules does. param: string $permalink_structure The permalink structure to generate rules. param: bool $walk_dirs Optional, default is false. Whether to create list of directories to walk over. return: array |
rewrite_rules() X-Ref |
Construct rewrite matches and queries from permalink structure. Runs the action 'generate_rewrite_rules' with the parameter that is an reference to the current WP_Rewrite instance to further manipulate the permalink structures and rewrite rules. Runs the 'rewrite_rules_array' filter on the full rewrite rule array. There are two ways to manipulate the rewrite rules, one by hooking into the 'generate_rewrite_rules' action and gaining full control of the object or just manipulating the rewrite rule array before it is passed from the function. return: array An associate array of matches and queries. |
wp_rewrite_rules() X-Ref |
Retrieve the rewrite rules. The difference between this method and {@link WP_Rewrite::rewrite_rules()} is that this method stores the rewrite rules in the 'rewrite_rules' option and retrieves it. This prevents having to process all of the permalinks to get the rewrite rules in the form of caching. return: array Rewrite rules. |
mod_rewrite_rules() X-Ref |
Retrieve mod_rewrite formatted rewrite rules to write to .htaccess. Does not actually write to the .htaccess file, but creates the rules for the process that will. Will add the non_wp_rules property rules to the .htaccess file before the WordPress rewrite rules one. return: string |
iis7_url_rewrite_rules( $add_parent_tags = false ) X-Ref |
Retrieve IIS7 URL Rewrite formatted rewrite rules to write to web.config file. Does not actually write to the web.config file, but creates the rules for the process that will. return: string |
add_rule($regex, $redirect, $after = 'bottom') X-Ref |
Add a straight rewrite rule. Any value in the $after parameter that isn't 'bottom' will be placed at the top of the rules. param: string $regex Regular expression to match against request. param: string $redirect URL regex redirects to when regex matches request. param: string $after Optional, default is bottom. Location to place rule. |
add_external_rule($regex, $redirect) X-Ref |
Add a rule that doesn't redirect to index.php. Can redirect to any place. param: string $regex Regular expression to match against request. param: string $redirect URL regex redirects to when regex matches request. |
add_endpoint($name, $places) X-Ref |
Add an endpoint, like /trackback/. See {@link add_rewrite_endpoint()} for full documentation. param: string $name Name of the endpoint. param: int $places Endpoint mask describing the places the endpoint should be added. |
add_permastruct( $name, $struct, $args = array() X-Ref |
Add a new permalink structure. A permalink structure (permastruct) is an abstract definition of a set of rewrite rules; it is an easy way of expressing a set of regular expressions that rewrite to a set of query strings. The new permastruct is added to the {@link WP_Rewrite::$extra_permastructs} array. When the rewrite rules are built by {@link WP_Rewrite::rewrite_rules()} all of these extra permastructs are passed to {@link WP_Rewrite::generate_rewrite_rules()} which transforms them into the regular expressions that many love to hate. The $args parameter gives you control over how {@link WP_Rewrite::generate_rewrite_rules()} works on the new permastruct. param: string $name Name for permalink structure. param: string $struct Permalink structure (e.g. category/%category%) param: array $args Optional configuration for building the rules from the permalink structure: |
flush_rules($hard = true) X-Ref |
Remove rewrite rules and then recreate rewrite rules. Calls {@link WP_Rewrite::wp_rewrite_rules()} after removing the 'rewrite_rules' option. If the function named 'save_mod_rewrite_rules' exists, it will be called. param: bool $hard Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush). Default is true (hard). |
init() X-Ref |
Sets up the object's properties. The 'use_verbose_page_rules' object property will be set to true if the permalink structure begins with one of the following: '%postname%', '%category%', '%tag%', or '%author%'. |
set_permalink_structure($permalink_structure) X-Ref |
Set the main permalink structure for the blog. Will update the 'permalink_structure' option, if there is a difference between the current permalink structure and the parameter value. Calls {@link WP_Rewrite::init()} after the option is updated. Fires the 'permalink_structure_changed' action once the init call has processed passing the old and new values param: string $permalink_structure Permalink structure. |
set_category_base($category_base) X-Ref |
Set the category base for the category permalink. Will update the 'category_base' option, if there is a difference between the current category base and the parameter value. Calls {@link WP_Rewrite::init()} after the option is updated. param: string $category_base Category permalink structure base. |
set_tag_base( $tag_base ) X-Ref |
Set the tag base for the tag permalink. Will update the 'tag_base' option, if there is a difference between the current tag base and the parameter value. Calls {@link WP_Rewrite::init()} after the option is updated. param: string $tag_base Tag permalink structure base. |
__construct() X-Ref |
Constructor - Calls init(), which runs setup. return: WP_Rewrite |
add_rewrite_rule($regex, $redirect, $after = 'bottom') X-Ref |
Add a straight rewrite rule. param: string $regex Regular Expression to match request against. param: string $redirect Page to redirect to. param: string $after Optional, default is 'bottom'. Where to add rule, can also be 'top'. |
add_rewrite_tag( $tag, $regex, $query = '' ) X-Ref |
Add a new rewrite tag (like %postname%). The $query parameter is optional. If it is omitted you must ensure that you call this on, or before, the 'init' hook. This is because $query defaults to "$tag=", and for this to work a new query var has to be added. param: string $tag Name of the new rewrite tag. param: string $regex Regular expression to substitute the tag for in rewrite rules. param: string $query String to append to the rewritten query. Must end in '='. Optional. |
add_permastruct( $name, $struct, $args = array() X-Ref |
Add permalink structure. param: string $name Name for permalink structure. param: string $struct Permalink structure. param: array $args Optional configuration for building the rules from the permalink structure, |
add_feed($feedname, $function) X-Ref |
Add a new feed type like /atom1/. param: string $feedname param: callback $function Callback to run on feed display. return: string Feed action name. |
flush_rewrite_rules( $hard = true ) X-Ref |
Remove rewrite rules and then recreate rewrite rules. param: bool $hard Whether to update .htaccess (hard flush) or just update |
add_rewrite_endpoint( $name, $places ) X-Ref |
Add an endpoint, like /trackback/. Adding an endpoint creates extra rewrite rules for each of the matching places specified by the provided bitmask. For example: <code> add_rewrite_endpoint( 'json', EP_PERMALINK | EP_PAGES ); </code> will add a new rewrite rule ending with "json(/(.*))?/?$" for every permastruct that describes a permalink (post) or page. This is rewritten to "json=$match" where $match is the part of the URL matched by the endpoint regex (e.g. "foo" in "<permalink>/json/foo/"). A new query var with the same name as the endpoint will also be created. When specifying $places ensure that you are using the EP_* constants (or a combination of them using the bitwise OR operator) as their values are not guaranteed to remain static (especially EP_ALL). Be sure to flush the rewrite rules - flush_rewrite_rules() - when your plugin gets activated and deactivated. param: string $name Name of the endpoint. param: int $places Endpoint mask describing the places the endpoint should be added. |
_wp_filter_taxonomy_base( $base ) X-Ref |
Filter the URL base for taxonomies. To remove any manually prepended /index.php/. param: string $base The taxonomy base that we're going to filter return: string |
url_to_postid($url) X-Ref |
Examine a url and try to determine the post ID it represents. Checks are supposedly from the hosted site blog. param: string $url Permalink to check. return: int Post ID, or 0 on failure. |
Generated: Tue Mar 25 01:41:18 2014 | WordPress honlapkészítés: online1.hu |