Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace update_option() calls with option_${option_name} filter hooks #44

Open
cjg89 opened this issue Aug 29, 2018 · 1 comment
Open
Assignees

Comments

@cjg89
Copy link
Member

cjg89 commented Aug 29, 2018

Update all explicit update_option() calls in the theme with option_${option_name} filter hooks to eliminate unneeded db updates.

@cjg89
Copy link
Member Author

cjg89 commented Sep 7, 2018

Tabling this issue for now due to the complexity of fixing issues with specific types of options we use in most of our plugins; namely, checkbox values. Most of our plugins don't apply formatting filters to retrieved option values (except when retrieved by internal methods only accessible at the per-plugin level), so, because WordPress saves those option values as strings (e.g. '1' instead of true), comparing empty strings and checkbox values becomes much more complex.

Additionally, because we have logic in many of our plugins that incorrectly displays checkbox fields in plugin option pages based on whether their value is a boolean true (example: https://github.com/UCF/UCF-Degree-Search-Plugin/blob/master/admin/ucf-degree-search-config.php#L390), even if we did implement conditional update_option()'s, the checkbox option values wouldn't be rendered accurately if those checkboxes have a default "checked" value and the value is changed on save (unless the plugin has returned option filters set up), because '1' !== true.

Going to leave the update-option branch open until we can address the problem further.

TL;DR: this problem will require more extensive updates to the rest of our plugins before we can reliably and accurately make these option updates conditional.

@cjg89 cjg89 changed the title Make update_option() calls conditional Replace update_option() calls with option_${option_name} filter hooks Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants