【发布时间】:2012-12-20 00:33:22
【问题描述】:
我正在尝试让 pre_get_posts 与传递参数一起工作。我的主题的function.php 文件中有以下功能。
function custom_pre_get_posts($query, $posttype, $poststatus, $paidvalue, $taxtype, $geo, $brands) {
//my long query is here
}
add_action('pre_get_posts', 'custom_pre_get_posts', 10, 7);
我通过以下代码通过我的 taxonomy.php 文件调用此函数:
do_action('pre_get_post','dealers', 'publish', '1', $taxtype, $geo, $brands);
在输出页面上,我得到了 custom_pre_get_posts() 的缺少参数 2、custom_pre_get_posts() 的缺少参数 3 等等。一直到参数 7。
我做错了什么?
【问题讨论】:
标签: wordpress function arguments