站长百科 | 数字化技能提升教程 数字化时代生存宝典
首页
数字化百科
电子书
▼
建站程序
开发
服务器
办公软件
开发教程
▼
服务器教程
软件使用教程
运营教程
热门电子书
▼
CSS教程
WordPress教程
导航
程序频道
推广频道
网赚频道
人物频道
网站程序
网页制作
云计算
服务器
CMS
论坛
网店
虚拟主机
cPanel
网址导航
WIKI使用导航
WIKI首页
热点词条
最新资讯
网站程序
站长人物
页面分类
使用帮助
编辑测试
创建条目
网站地图
站长百科导航
站长百科
主机侦探
IDCtalk云说
跨境电商导航
WordPress啦
站长专题
网站推广
网站程序
网站赚钱
虚拟主机
cPanel
网址导航专题
云计算
微博营销
虚拟主机管理系统
开放平台
WIKI程序与应用
美国十大主机
编辑“
WordPress:Query Overview
”(章节)
人物百科
|
营销百科
|
网赚百科
|
站长工具
|
网站程序
|
域名主机
|
互联网公司
|
分类索引
跳转至:
导航
、
搜索
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
=== 插件可以更改什么 === Here is an overview of the things a plugin can do to modify the default query and permalink behavior described above. Many of these modifications are described (with examples) in the article [[WordPress:Custom Queries]]. 下面是一个概述,关于插件可以怎样做,更改默认查询和上述的permalink。许多这样的更改在[[WordPress:Custom Queries|自定义查询]]中有描述(带有例子)。 * Add, modify, or remove rewrite rules, to affect how permalinks are parsed. This is generally not done with filters and actions, but instead by calling functions in <tt>wp-includes/rewrite.php</tt>, such as <tt>add_rewrite_rule</tt>, <tt>add_rewrite_endpoint</tt>, etc. This can be a bit tricky, because <tt>WP_Rewrite->wp_rewrite_rules()</tt> usually just gets the previously-saved set of rewrite rules (they are saved in the WordPress database as option "rewrite_rules"). So if you want to modify rewrite rules, you will need to call <tt>$wp_rewrite->flush_rules()</tt> to force them to recalculate. You'll need to do this in your plugin's <tt>init</tt> action, so that it happens early enough in the process. *添加,更改,或者移除重写规则,会影响permalinks的解析方式。这些通过不是过滤器或者actions完成的,而是通过调用<tt>wp-includes/rewrite.php</tt>中的函数,例如<tt>add_rewrite_rule</tt>, <tt>add_rewrite_endpoint</tt>,等等。这样做有些微妙,因为<tt>WP_Rewrite->wp_rewrite_rules()</tt>通常只得到先前保存的改写规则(这些规则保存在 WordPress 数据库作为选项"rewrite_rules")。因此,如果你想要更改改写规则,你需要在你的插件的<tt>init</tt>操作中更改,因此更改过程很早就发生了。 * Add or remove query variables, to affect which variables are saved in the query specification from POST, GET, and permalink requests (<tt>query_vars</tt> filter). *添加或者移除查询变数,影响哪个变数保存在来自文章,GET和permalink请求(<tt>query_vars</tt> filter)的查询specification。 * Modify the query specification, after variable values are saved (<tt>request</tt> filter or <tt>parse_request</tt> action; if you want to use conditional tag tests, use the <tt>parse_query</tt> or <tt>pre_get_posts</tt> action, as these run after the <tt>is_</tt> variables are set). *变数值保存后,更改query specification(<tt>request</tt> 过滤器或者<tt>parse_request</tt> action; 如果你想使用条件式标签测试,请使用 <tt>parse_query</tt> 或者 <tt>pre_get_posts</tt> action, 因为<tt>is_</tt> 变数设置好之后,这些才会运行)。 * Modify the MySQL database query, after it is created from the query specification (<tt>posts_where</tt>, <tt>posts_join</tt>, <tt>posts_groupby</tt>, <tt>posts_orderby</tt>, <tt>posts_distinct</tt>, <tt>posts_fields</tt>, <tt>post_limits</tt>, <tt>posts_where_paged</tt>, <tt>posts_join_paged</tt>, and <tt>posts_request</tt> filters). *MySQL数据库query从query specification中创建好之后,更改MySQL数据库query(<tt>posts_where</tt>, <tt>posts_join</tt>, <tt>posts_groupby</tt>, <tt>posts_orderby</tt>, <tt>posts_distinct</tt>, <tt>posts_fields</tt>, <tt>post_limits</tt>, <tt>posts_where_paged</tt>, <tt>posts_join_paged</tt>, 和<tt>posts_request</tt> 过滤器)。 * Modify the results of the database query (<tt>the_posts</tt> filter). *更改数据库query的结果(<tt>the_posts</tt> 过滤器)。 * Override the default template file choice (<tt>template_redirect</tt> action). *废除默认模板文件选择(<tt>template_redirect</tt> action)。
摘要:
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅
Wordpress-mediawiki:版权
的细节)。
未经许可,请勿提交受版权保护的作品!
取消
编辑帮助
(在新窗口中打开)