The best way IMO would be to alter the passed attribute through the “shortcode_atts_{$shortcode}” filter. I’m assuming the shortcode handler uses the related function, which most do that accept passed attributes. {$shortcode} in this case would be “get_sheet_value” Your filter callback would get the form value from $_REQUEST or similar and alter the appropriate element in the passed array. You’d likely want to use logic where the data is only altered if a value is available in $_REQUEST, otherwise the value from the shortcode is retained.
https://developer.wordpress.org/reference/hooks/shortcode_atts_shortcode/
Thanks! I don’t really know how to do that, but I had another idea. Is there a way that when the form is submitted the name is saved to a variable that is accessible by other plugins and on different pages. So instead of passing the name through the shortcode, the plugin just gets the variable for the name.
Accessible on different pages means the variable’s value would need to be saved in a persistent manner. Variable values normally only persist for the current request. The data can be saved somewhere in the DB and accessed by other pages as needed. Where to save depends on the nature of the data. A few possibilities of many are post or user meta, options, or temporary transients.
You will need form handling code that saves the form data somewhere. There are several ways to do so. One way is to include such code on the template that outputs the form. The form would be set to POST submissions. If the template sees a GET request, it outputs the form. If it sees a POST request, it saves the data from $_POST to the DB.
Okay thanks! Simple question, how would I delete a row in my database, from my plugin? I know it’s $wpdb->delete(); but I don’t what to put for array $where
Without $where, how would the function know which row to delete?
If doing so programmatically were not a requirement, you can manually delete stray, undesired rows through the phpMyAdmin app. Emphasis on “stray”. If the deleted row is tied to other data in the DB, it could cause WP to malfunction. It’s always wise to make backups before doing anything with phpMyAdmin unless you’re absolutely sure you know what you’re doing is completely safe.