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(分类):

转载于:https://www.cnblogs.com/kais7mg/p/7735449.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值