Appearance
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

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_idto access the current WordPress user ID in your SQL. (read moreβ¦)
sql
user_id = @wpda_wp_user_idExample Using Shortcode Parameters β
Shortcode
wpda_appsupports 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 towhere status = 'send'.
