get_{$adjacent}_post_where

过滤钩子
apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p.post_type = %s $where", $current_post_date, $post->post_type )
参数
  • (string) $where The `WHERE` clause in the SQL.
    Required:
    Default: %s {$where}", $current_post_date, $post->post_type)
  • (bool) $in_same_term Whether post should be in a same taxonomy term.
    Required:
  • (int[]|string) $excluded_terms Array of excluded term IDs. Empty string if none were provided.
    Required:
  • (string) $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true.
    Required:
  • (WP_Post) $post WP_Post object.
    Required:
定义位置
相关勾子
get_adjacent_post_sortget_adjacent_post_joinget_adjacent_post_excluded_termsadjacent_post_rel_linkgetarchives_where
相关方法
get_adjacent_postget_adjacent_post_rel_linkget_adjacent_post_linkadjacent_posts_rel_linkadjacent_post_linkget_parent_post_rel_link
引入
4.4.0
弃用
-

get_{$adjacent}_post_where: 此函数用于检索获取相邻文章的查询中的过滤语句。

为相邻的后期查询过滤SQL中的WHERE子句。

钩子名称的动态部分$adjacent指的是邻接类型,“next”或“previous”。

可能的挂钩名称包括:

  • get_next_post_where
  • get_previous_post_where
$where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p.post_type = %s $where", $current_post_date, $post->post_type ), $in_same_term, $excluded_terms, $taxonomy, $post );

常见问题

FAQs
查看更多 >