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

βοΈ Disable WHERE clause validation on INSERT β
On INSERT, the data is validated against the default WHERE clause. If the clause is not satisfied, the INSERT fails. Enable this option to skip this validation.
π Rows that do not satisfy the default WHERE clause will not be shown after INSERT.
β¨ Example: AUTO INCREMENT column β
An AUTO INCREMENT column does not have a value during an insert. The following default WHERE clause will fail validation on INSERT:
sql
id > 90000To fix the validation error on INSERT:
- Enable the "Disable WHERE clause validation on INSERT" option to skip validation on INSERT.
- Or change the default WHERE clause to
(id > 90000 OR id = '')to keep validation on INSERT.
Examples β
β¨ Example: Hardcoded Condition β
sql
first_name like 'Sacha%'β¨ Example: 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'.
