I am making a theme and it has so many options that need to be updated via jquery’s ajax.Having looked at ways of updating wp_options via ajax,i have hypothesised that updating the wp_options table would be the easy way out for me.
Are there risks if update the options that way or is it safer to go the api way?.
Updating options via pure SQL is wrong.
If you feel you have too many options to use the regular API you probably have too many options at all. A theme should not do the job a plugin can do. In fact, it should do as little as possible and let the user choose a plugin for simple tasks.
Examples are fields for tracking codes or sharing meta data.
Store your options in one array under a single option name. The API will serialize it for you. Exceptions are options you need on de/activation only like the theme version.
If you use the API plugins can hook into
pre_get_option_*
and extend or change what you do. Donât break that, you cannot know what your users need.