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
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$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 );
$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 );
$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
檢視更多 >