-
Notifications
You must be signed in to change notification settings - Fork 4
Query Builder
Ale Mostajo edited this page Jun 26, 2020
·
2 revisions
The QueryBuilder class allows to build up a query using its methods. It uses $wpdb in its core to build and execute the queries.
Start using the query builder by calling the global function wp_query_builder():
$builder = wp_query_builder();This will return an instance of TenQuality\WP\Database\QueryBuilder ready to be used.
Alternatively, in order to use the class directly, this must be instantiated into a variable; requires to use php's use statement at the beginning of the script:
use TenQuality\WP\Database\QueryBuilder;Default:
$builder = new QueryBuilder();Using an ID to identify the query (which can be later use for wordpress hooks):
$builder = new QueryBuilder( 'my_query' );Default:
$builder = QueryBuilder::create();Using an ID:
$builder = QueryBuilder::create( 'my_query' );(c) 2019 - 10 Quality - Query Builder Library for Wordpress