Are there risks associated with using wp_options table using wpdb to update theme options

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?.

Related posts

Leave a Reply

1 comment

  1. Updating options via pure SQL is wrong.

    1. 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.

    2. 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.

    3. 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.