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.html
WordPress容許主題和插件開發人員以編程方式指定新的自定義重寫規則。如下功能(主要爲wp_rewrite【中文】方法的別名)能夠用來實現這。web
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(分類):ide