terms_pre_query

過濾鉤子
apply_filters_ref_array( 'terms_pre_query', array( $this->terms, &$this )
引數
  • (array|null) $terms Return an array of term data to short-circuit WP's term query, or null to allow WP queries to run normally.
    Required:
  • (WP_Term_Query) $query The WP_Term_Query instance, passed by reference.
    Required:
定義位置
相關勾子
sites_pre_querynetworks_pre_queryparse_term_queryrest_term_search_querythe_search_query
相關方法
the_search_querywp_reset_queryregister_block_core_queryremove_query_argget_search_queryis_main_query
引入
5.3.0
棄用
-

terms_pre_query – 這個動作在術語查詢執行前執行。這個動作通常用於修改查詢引數或在查詢執行前執行其他動作。

在查詢發生之前過濾術語陣列。

返回非空值以繞過WordPress的預設術語查詢。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$this->terms = apply_filters_ref_array( 'terms_pre_query', array( $this->terms, &$this ) );
$this->terms = apply_filters_ref_array( 'terms_pre_query', array( $this->terms, &$this ) );
$this->terms = apply_filters_ref_array( 'terms_pre_query', array( $this->terms, &$this ) );

常見問題

FAQs
檢視更多 >