wpseek.com
WordPress开发者和主题制作者的搜索引擎



pre_get_posts › WordPress动作钩子

Since2.0.0
已弃用n/a
› do_action_ref_array( 'pre_get_posts', array( &$this )
参数:
  • () query The WP_Query instance (passed by reference).
    Required: Yes
定义在:
文档:

Fires after the query variable object is created, but before the actual query is run.

Note: If using conditional tags, use the method versions within the passed instance (e.g. `$query->is_main_query()` instead of `is_main_query()`). This is because the functions like `is_main_query()` test against the global `$wp_query` instance, not the passed one.




源码

do_action_ref_array( 'pre_get_posts', array( &$this ) );