Hello,
Thanks for the feedback!
The Flexible Content Dynamic Render scripts/styles are enqueued right after the the_flexible()
usage on the front-end.
If you don’t want to enqueue those files, but rather do it manually outside of the WordPress logic, there are two solutions:
- Leave the script/style settings empty in your layouts, and enqueue your files using your own method.
- If you want to keep these layout settings, but don’t ant to enqueue them, then you’ll have to overwrite the handles to avoid them being enqueued.
You can achieve that by registering styles/scripts with empty paths inside the wp_enqueue_scripts
WP hook (See documentation).
ACF Extended generate handles with the Flexible Content field name and the Layout name, using this pattern {flexible_content_name}-layout-{layout_name}
.
So for a Flexible Content names “my_flexible”, handles will be called:
- my_flexible-layout-my_hero
- my_flexible-layout-my_gallery
- etc…
Here is a usage example to overwrite these handles with an empty path:
add_action('wp_enqueue_scripts', 'my_enqueue_scripts');
function my_enqueue_scripts(){
// prevent acfe automatic style enqueue
wp_register_style('my_flexible-layout-my_hero', false);
wp_register_style('my_flexible-layout-my_gallery', false);
}
Hope it helps!
Have a nice day!
Regards.