get_meta_sql

函数
get_meta_sql ( $meta_query, $type, $primary_table, $primary_id_column, $context = null )
参数
  • (array) $meta_query A meta query.
    Required:
  • (string) $type Type of meta.
    Required:
  • (string) $primary_table Primary database table name.
    Required:
  • (string) $primary_id_column Primary ID column name.
    Required:
  • (object) $context Optional. The main query object
    Required:
    Default: null
返回值
  • (string[]|false) { Array containing JOIN and WHERE SQL clauses to append to the main query, or false if no table exists for the requested meta type. @type string $join SQL fragment to append to the main JOIN clause. @type string $where SQL fragment to append to the main WHERE clause. }
相关
  • WP_Meta_Query
定义位置
相关方法
get_tax_sqlget_meta_keys_get_meta_tableget_tagsget_comments
引入
3.2.0
弃用
-

get_meta_sql函数用于生成可用于查询WordPress数据库中元数据的SQL条款: 这个函数可以用来对元数据进行自定义查询。

给定一个元查询,生成SQL条款,附加到主查询中。

function get_meta_sql( $meta_query, $type, $primary_table, $primary_id_column, $context = null ) {
	$meta_query_obj = new WP_Meta_Query( $meta_query );
	return $meta_query_obj->get_sql( $type, $primary_table, $primary_id_column, $context );
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-06 08:33:13

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: