Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
5.8.0-beta4: Plugin calls get_option() and performs DB queries for empty/missing fields assigned to a block during registration #150
Scared with hundreds of database queries reported by Query Monitor on my website I have made some tests and it seems that ACF is calling get_option() every time when the block inserted into the content does not actually contain the field keys predicted during registration via acf_add_local_field_group().
So when I add an empty block which looks within the code like:
the plugin looks for the missing fields in wp_options table, for example:
where my-header-content is the name of a field type group in this case.
It's quite surprising for me - why ACF thinks that I store any block data in wp_options?
Then, when I add some text into the subfield of my-header-content field, the plugin no longer queries wp_options for my-header-content and the block structure grows into:
which is valid. (Actually, it calls get_option() for other missing subfields like those under my-header-aside-settings, until I fill them)
@macemmek Sure thing. The fix is simple.
Please edit the "includes/local-meta.php" file on line 204 and change