Rewrite API, rewriteapi

Source: Internet
Author: User

Rewrite API, rewriteapi

Address: https://codex.wordpress.org/Rewrite_API

Rewrite API (Rewrite rule API) Description (Description)

WordPress allows theme and plugin developers to programmatically specify new, custom rewrite rules. The following funwing (which are mostly aliases for WP_Rewrite methods) can be used to achieve this.

WordPress allows theme and plug-in developers to specify new custom Rewrite Rules programmatically. The following functions (mainlyWp_rewriteMethod alias) can be used to achieve this.

Note that these rules are usually called insideinitHook. furthermore, permalinks will need to be refreshed (you can do this from your admin under (Settings> Permalinks) before the rewrite changes will take effect. requires one-time use of flush_rules () to take effect. see also Flushing Rewrite on Activation.

Note that these rules are generally called within the init hook. In addition, the change will take effect before the permanent link needs to be refreshed (you can rewrite it from your management (Settings> fixed link .. Use flush_rules () at one time. For more information, seeRefresh and rewrite activated.

API Reference (API Reference) Articles (article)
  • Lesson:Rewrite API Overview
  • Class:WP_Rewrite ()-An overview of WordPress's built-in URL rewrite class.
  • Course: Overview of rewriting APIs
  • Class:WP_Rewrite ()-WordPress built-inURL rewritingClass overview.
Hooks (Hook)

 

  • Filter:Root_rewrite_rules-Filters the rewrite rules generated for the root of your weblog.
  • Filter:Post_rewrite_rules-Filters the rewrite rules generated for permalink URLs.
  • Filter:Page_rewrite_rules-Filters the rewrite rules generated for your Pages.
  • Filter:Date_rewrite_rules-Filters the rewrite rules generated for dated archive URLs.
  • Filter:Search_rewrite_rules-Filters the rewrite rules generated for search URLs.
  • Filter:Comments_rewrite_rules-Filters the rewrite rules generated for the latest comment feed URLs.
  • Filter:Author_rewrite_rules-Filters the rewrite rules generated for author archive URLs.
  • Filter:Rewrite_rules_array-FiltersAllThe rewrite rules at once.
  • Filter:{$ Permastruct} _ rewrite_rules-Can be used to create or modify rewrite rules for any customPermastructs, SuchTaxonomiesOrCustom post types.
  • Action:Generate_rewrite_rules-RunsAfterAll the rules have been created.
  • Filter:Root_rewrite_rules-Filter, which isRoot of your blogThe generated rewrite rule. (Blog root)
  • Filter:Post_rewrite_rules-Filters:URL of permanent linkGenerated rewrite rules. (Article)
  • Filter:Page_rewrite_rules-Filters:PageGenerated rewrite rules. (page)
  • Filter:Date_rewrite_rules-Filters:Outdated archive URLGenerated rewrite rules. (date archiving)
  • Filter:Search_rewrite_rules-Filters:Search URLGenerated rewrite rules. (search page)
  • Filter:Comments_rewrite_rules-Filters:Latest comment subscription URLGenerated rewrite rules. (comment subscription)
  • Filter:Author_rewrite_rules-Filters:Author archiving URLGenerated Rewrite Rules (archived by the author)
  • Filter:Rewrite_rules_array-Filters: All rewrite rules at the moment. (ALL Rewrite Rules)
  • Filter:{$ Permastruct} _ rewrite_rules-Can be used to create or modify any customFixed LinkRewrite Rules, suchCategoryOrCustom Document Type.
  • Action:Generate_rewrite_rules-All rules are created.Run later.(After)
Functions (function)
  • Add_rewrite_tag ()-Can be used to allow WordPress to recognize varim variables (participant ularly custom querystring variables ).
  • Add_rewrite_rule ()-Allows you to specify new, custom rewrite rules.
  • Add_rewrite_endpoint ()-Add a new endpoint like/trackback/
  • Flush_rules ()-Regenerate the rewrite rules and save them to the database.
  • Flush_rewrite_rules ()-Remove rewrite rules and then recreate rewrite rules.
  • Generate_rewrite_rules ()-Generates rewrite rules from a permalink structure
  • Add_permastruct ()-Add a new permastruct
  • Add_feed ()-Add a new feed type like/atom1/
  • Add_rewrite_tag ()-it can be used to allow WordPress to identify custom variables (especially custom query string variables.
  • Add_rewrite_rule ()-allows you to specify a new, custom rewrite rule.
  • Add_rewrite_endpoint ()-Add a newEndpointFor example,/trackback/
  • Flush_rules ()-RegenerateRewrite the rule andSaveTo the database.
  • Flush_rewrite_rules ()-RemoveRewrite the rule, and thenRecreateRewrite Rules.
  • Generate_rewrite_rules ()-accordingFixed Link StructureGenerateRewrite Rules
  • Add_permastruct ()-Add a newFixed Link Structure
  • Add_feed ()-Add a new subscription type, such as/atom1/

Categories ):

  • Advanced Topics (Advanced topic)
  • WordPress Development)
  • API (API)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.