I'm using some custom meta boxes with TinyMCE fields to let the client edit separate tabs on a page. When they embed a Gravity Form in one of these fields, the necessary scripts don't get enqueued.
It looks like this is because GFFormDisplay::enqueue_scripts
looks through the current WP query content for forms. I'm wondering, might it be possible for Gravity Forms to scan for forms using the the_content
filter? I output all my custom TinyMCE fields with this filter, so presumably the forms would be detected, and the scripts would go in the footer.
Meantime, could you help me with a hack? I've tried this in my theme's functions.php:
add_filter( 'the_content', 'slt_enqueue_gforms_scripts' );
function slt_enqueue_gforms_scripts( $content ) {
$forms = GFFormDisplay::get_embedded_forms( $content, $ajax );
foreach( $forms as $form)
GFFormDisplay::enqueue_form_scripts( $form, $ajax );
return $content;
}
However, it seems that enqueue_scripts
can't call get_embedded_forms
, because the latter is a private method. Any way to do this?