You can find several options for your field column in the column settings.
To access this setting, go to Form Builder > COLUMNS > navigate to a column > Column Settings.
Default Value #
Default value applied on insert only. Leave empty to use column default constraint.
- Column default constraints defined in the database are automatically applied
Examples: #
The following variable returns the WordPress user ID or 0 for anonymous requests.
@wpda_wp_user_id
Returns the current date/time and works with datetime fields only
@now
Other settings: #
- Prefix-Suffix: Adds a prefix and/or suffix to the column content.
- CSS classes: Add CSS classes (separated by spaces) for custom styling.
- Hint: Help text displayed below data entry field.
How can I return username instead of user_id ?
Adding custom session variables is explained here:
https://wpdataaccess.com/docs/variable/wordpress-user-id-in-sql/
See section: Need more WordPress values in SQL?
Dear WP Data Access Support Team,
I am using WP Data Access to display a table in the frontend using a shortcode. I would like to pass a default value for a specific field when displaying the table.
Is there a way to set a default value within the shortcode? For example, something like:
[wpda_table id=”1″ default=”fieldname=default_value”]
If this is not currently supported, is there an alternative method to achieve this?
I appreciate your support and look forward to your response.
Best regards
Hi Benjamin,
With the App Builder, it’s not possible to add field parameters to the shortcode. What we can suggest is to use the Default Where clause of your table to set a static filter of your table.
See here: https://wpdataaccess.com/docs/table-builder-filters/default-where/
Hope this helps! Let us know if you have more questions.
Hi Kim,
Thank you for your response! I understand that it’s not possible to pass field parameters in the shortcode and that the “Default Where” clause is a possible workaround for static values.
However, I need to set a dynamic default value for a specific field in my table, depending on the context (e.g., user input, session data, or URL parameters).
I’ve attempted to modify the field value using jQuery after the page loads, but I haven’t been successful. Is there another way to dynamically set or override a field value in WP Data Access when displaying the table in the frontend?
Any guidance or alternative solutions would be highly appreciated.
Best regards,
Benjamin
Hi Benjamin,
Peter just added a new documentation for App Builder shortcodes that should work for your use case.
Check it out here: https://wpdataaccess.com/docs/table-builder-filters/shortcode-parameters/
Hope that helps! Let us know if you have other questions.