Performance of several get_option() calls


I am currently working on my first WordPress plugin. To save and output certain settings I use the native Settings API. Now the question arises, how performant are several calls of the get_option() function.

Since I work object-oriented I use a function which returns the options:

private function get_settings() {
    $styles = get_option("style_settings");
    return $styles;

Every time I need one or more values from the options array, I now call this function. Is it better to assign the options in the constructor to a variable or does it not matter for the performance?

JonasLoerken 2 months 0 Answers 14 views 0

Leave an answer