BP_Media_Query::get_sql( string $alias = 'm' )
Generates WHERE SQL clause to be appended to a main query.
Description
Parameters
- $alias
-
(Optional) An existing table alias that is compatible with the current query clause. Default: 'a'. BP_Media::get() uses 'a', so we default to that.
Default value: 'm'
Return
(string) SQL fragment to append to the main WHERE clause.
Source
File: bp-media/classes/class-bp-media-query.php
public function get_sql( $alias = 'm' ) { if ( ! empty( $alias ) ) { $this->table_alias = sanitize_title( $alias ); } $sql = $this->get_sql_clauses(); // We only need the 'where' clause. // // Also trim trailing "AND" clause from parent BP_Recursive_Query class // since it's not necessary for our needs. return preg_replace( '/^\sAND/', '', $sql['where'] ); }
Changelog
Version | Description |
---|---|
BuddyBoss 1.1.9 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.