Beware of this wordpress function


I am not sure how many of the developers note this when using this wordpress function, but if you didn't notice this, then you might end up with performance issues.





The function i am taking about is update_option.





Two arguments are required to invoke the function which is the option name and option value. The performance issue will happen if you don't specify the third argument to false. The third argument i am talking about is the autoload. By default it is set to true.





What is options autoload?





If the autoload is set to true, the option will be loaded on every request to wordpress. By default the value is true unless specified by the developer. Especially if you are using options to store a lot of data because the data you are storing are not related to posts. This will slow down wordpress. So take extra care for every update option calls, or you can define a custom function which sets this value as false and invoke it.


Share:

0 comments:

Post a Comment