Is it ok to call get_option without hooks?
Many plugins call get_option()
to fetch their settings right in the main plugin file, without using any action hook. Is this the way it is meant to be used?
I am asking because it seems to me that calling get_option()
straight away has two downsides:
- Extensibility: It makes it hard if not impossibile for devs to reliably filter the plugin options with the
option_{$option}
filter. A workaround is to use a must-use plugin, but that is not always an option. - Performance: The options will be fetched at every pageload also if they are not needed (even though this is mitigated by the presence of the options cache).
Topic plugin-options options plugins Wordpress performance
Category Web