Skip to content
πŸš€ Rapid Application Development with the App Builder

Default Where ​

The default WHERE clause must be provided as valid SQL. It supports dynamic access to the WordPress user ID, URL parameters, and shortcode parameters.

The screenshot below shows the result for the URL: https://domain.com/page/?dname=sales

WP Data Access - Table Builder - Default WHERE

Examples ​

✨ Hardcoded Condition ​

sql
first_name like 'Sacha%'

✨ Example of a Subquery ​

sql
user_id in
	(
		select user_id 
		from wp_usermeta 
		where meta_key = 'wp_capabilities'
		  and meta_value like '%coach%'
	)

✨ Example Using SQL Functions ​

sql
order_date between date_sub(now(), interval 1 week) and now()

✨ Example Combining Conditions ​

sql
where status = 'send'
  and order_date > date_sub(now(), interval 1 week)

Using HTTP GET and POST Parameters ​

Use the built-in variables httpGet, httpPost, and httpRequest to access parameters from a request. These functions return null if the specified parameter is not provided. (read more...)

✨ Example Using a POST Parameter ​

sql
where product_id = httpPost['my_product_id']
  and httpPost['my_product_id'] is not null

✨ Example Using a URL (GET) Parameter ​

sql
where product_id = httpGet['my_product_id'] 
  and httpGet['my_product_id'] is not null

✨ Example Using the WordPres User ID ​

Use the session variable @wpda_wp_user_id to access the current WordPress user ID in your SQL. (read more…)

sql
user_id = @wpda_wp_user_id

Example Using Shortcode Parameters ​

Shortcode wpda_app supports custom parameters, allowing users to add any parameter to a shortcode and safely reference its value in WHERE clauses. (read more...)

sql
WHERE status = IFNULL(shortcodeParam['status'], status)

πŸ“Œ Notes ​

  • The keyword WHERE is optional in this clause. For example, status = 'send' is functionally similar to where status = 'send'.