Given a meta query, generates SQL clauses to be appended to a main query.
Description
See also
Parameters
$meta_query
arrayrequired- A meta query.
$type
stringrequired- Type of meta.
$primary_table
stringrequired- Primary database table name.
$primary_id_column
stringrequired- Primary ID column name.
$context
objectoptional- The main query object.
Default:
null
Source
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 );
}
Changelog
Version | Description |
---|---|
3.2.0 | Introduced. |
Example
Output depending on the meta query: