Rewrite API --重写规则API

 

Rewrite API(重写规则API)

Description(描述)


 

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

WordPress允许主题和插件开发人员以编程方式指定新的自定义重写规则。以下功能(主要为wp_rewrite中文方法的别名)可以用来实现这。

Note that these rules are usually called inside the init hook. 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.注意,这些规则通常在init钩子内部调用。此外,永久链接将需要刷新(你可以从你的管理下(设置> 固定链接)重写之前,修改将生效。。要求一次性使用flush_rules()生效。参见关于激活的刷新重写

API Reference(API引用)

Articles(文章)


 

  • Lesson: Rewrite API Overview
  • Class: WP_Rewrite() - An overview of WordPress's built-in URL rewrite class.
  • 课程:重写API概述
  • Class: WP_Rewrite()【中文 - WordPress内置的URL重写类概述。

Hooks (钩子)

#这些钩子和动作的位置是 WP_Rewrite类 的  rewrite_rules()方法 


 

  • Action: generate_rewrite_rules - Runs after all the rules have been created.
  • Filter: root_rewrite_rules - 过滤器,为你的博客的根生成的重写规则。(博客根)【中文】
  • Filter:post_rewrite_rules - Filters,为永久链接的URL生成的重写规则. (文章)
  • Filter: page_rewrite_rules - Filters,为页面生成的重写规则. (页面)
  • Filter: date_rewrite_rules - Filters,为过时的归档URL生成的重写规则. (日期归档)
  • Filter: search_rewrite_rules - Filters,为搜索URL生成的重写规则. (搜索页)
  • Filter: comments_rewrite_rules - Filters,为最新评论订阅 URL生成的重写规则. (评论订阅)
  • Filter: author_rewrite_rules - Filters,为作者归档URL生成的重写规则. (作者归档)
  • Filter: rewrite_rules_array - Filters,此刻的所有重写规则. (所有的重写规则)
  • Filter: {$permastruct}_rewrite_rules - 可用于创建或修改任何自定义固定链接重写规则,如分类自定义文章类型.
  • Action: generate_rewrite_rules -在创建了所有规则之后运行. (after

Functions(函数)


      Categories(分类):

posted @ 2017-10-26 10:13  kais7mg  阅读(1081)  评论(0编辑  收藏  举报