function get_meta_sql( $meta_query, $type, $primary_table, $primary_id_column, $context = null ) {}

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


  • array $meta_query: A meta query
  • string $type: Type of meta
  • string $primary_table
  • string $primary_id_column
  • object $context: (optional) The main query object

Return values

returns:‘join’ => $join_sql, ‘where’ => $where_sql )

Source code

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



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: