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
定义位置
  • wp-includes/meta.php
    , line 1242
引入
3.2.0
弃用

Given a meta query, generates SQL clauses to be appended to a main query.

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 );
}