Hi theme.co team!
I’ve dived deeper into the Cornerstone Parameters API recently to create dynamic select controls (e.g., populating a dropdown with Taxonomy Terms via get_terms ).
While this works functionally, it creates a potential performance bottleneck for dynamic data if i use this in a 'init' hook for example. If we run a heavy DB query (like get_terms or WP_Query ) inside the init hook to populate the options array, this query runs on every single page load (Frontend, Backend, AJAX), even when Cornerstone is not active.
My Findings: I discovered that a much more performant approach is to “lazy load” the cornerstone_before_boot_app hook.
By moving the logic into this filter, the database queries are only executed when the Cornerstone Builder actually loads , saving resources on the frontend and standard WP Admin pages.
Do you see any possible issues with using this hook?
If not I would suggest adding this info to the “Parameters API” documentation.
Thanks in advance