WPDev.one
Core Function
View Source on Trac ↗

get_meta_sql()

get_meta_sql( mixed $meta_query, mixed $type, mixed $primary_table, mixed $primary_id_column, mixed $context = null )

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

Parameters 4 required

Name / Type Description
$meta_query
array

A meta query.

Required
$type
string

Type of meta.

Required
$primary_table
string

Primary database table name.

Required
$primary_id_column
string

Primary ID column name.

Required
$context
object

Optional. The main query object. Default null.

Return Value

((string[])
(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.

Function Information

Since Version
3.2.0
Source File
wp-includes/meta.php
Advertisement