Is a series of update_option calls safe, performance wise?

0 Votes
    446 Views

I have coded up a function that sets plenty of WordPress options in series.

For example:

update_option('option1', '0');
update_option('option2', '0');
update_option('option3', '0');
update_option('option4', '1');
update_option('option5', '1');
update_option('option6', '0');
update_option('option7', '1');

I understand that what this function does is change values in the database. I am aware that when using get_option, a form of caching takes place, so it could be considered safe. However, for update_option, I am not very sure.

I couldn’t find a function like update_option that accepts multiple options to update. So is doing it like this good for performance? Is there another safer way of doing it?

4

Answers


Please signup or login to answer this question.