过滤器:root_rewrite_rules

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了过滤器:root_rewrite_rules相关的知识,希望对你有一定的参考价值。

原文:https://codex.wordpress.org/Plugin_API/Filter_Reference/root_rewrite_rules

 

实例,

技术分享
function my_htaccess_contents( $rules )
{
     var_dump($rules);
     exit();
    return $rules . "# My little addition!\n";
}
add_filter(‘root_rewrite_rules‘, ‘my_htaccess_contents‘);
View Code

 

查看URL地址:http://localhost/wordpress/wp-admin/options-permalink.php

技术分享
array
  ‘feed/(feed|rdf|rss|rss2|atom)/?$‘ => string ‘index.php?&feed=$matches[1]‘ (length=27)
  ‘(feed|rdf|rss|rss2|atom)/?$‘ => string ‘index.php?&feed=$matches[1]‘ (length=27)
  ‘embed/?$‘ => string ‘index.php?&embed=true‘ (length=21)
  ‘page/?([0-9]{1,})/?$‘ => string ‘index.php?&paged=$matches[1]‘ (length=28)
View Code

 

 


 

Plugin API/Filter Reference/root rewrite rules

Description(描述)

This filter hook can be used to modify rewrite rules for your sites root.

这个过滤器钩子可以用来修改你的站点根目录的重写规则。

Source File(源文件)

This hooks is located in the WP_Rewrite class in wp-includes/class-wp-rewrite.php

这个钩子位于 WP_Rewrite 类,文件是 wp-includes/class-wp-rewrite.php

Related(相关的)

Articles

Hooks

  • 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 - Filters all the rewrite rules at once.
  • Filter: {$permastruct}_rewrite_rules - Can be used to create or modify rewrite rules for any custom permastructs, such as taxonomies or custom post types.
  • Action: generate_rewrite_rules - Runs after all the rules have been created.

Functions

 

以上是关于过滤器:root_rewrite_rules的主要内容,如果未能解决你的问题,请参考以下文章

日期作为 Webi 报告的输入参数

java web项目中过滤器的使用(过滤器执行多次)????

Android Adapter代码片

代码片|水波纹

构建数据相似系统

代码片--练习匿名内部类