CMBData is output repeatedly
Closed this issue · 3 comments
Hey @rmccue or @tareiking I can't replicate this locally, could you give me some more context on the fieldset and/or amount of data causing this? Like, is it a ton of individual or repeated WYSIWYG fields making this?
Ignore the above, I just figured it out :)
As an update, this is looking like a core issue to me. Core allows you to re-register the same localize
variable over and over again without any checks whether it's already been registered already. I see no easy way to see if we've already registered this script as localized but will keep digging over time.
A workaround might be to check if cmb-scripts
is already enqueued with wp_script_is()
before adding the action in the CMB_Meta_Box
construct method or inside enqueue_scripts()
method.
if ( ! wp_script_is( 'cmb-scripts' ) ) {
// Enqueue and/or localize 'cmb-scripts'.
}