Smart Assets Loading

WPBakery Page Builder is using smart algorithm for loading frontend assets (JavaScripts and CSS). Particularly, it's looking at post's main content and if

shortcode is there, then assets will be loaded, because it means that WPBakery Page Builder was used to create a content of the current post. This was done to improve frontend performance, e.g. don't waste resources when they are not needed.

Visual Composer field brought by WP ACF-VC Bridge plugin is ACF field and is not the part of a posts's main content. This is why WPBakery can't automatically determine if it should load frontend assets.

Simple solution

One of the quickest way would be adding "
" to post’s main content.

Force Loading Frontend Assets Using PHP

You can add the following code to functions.php. This will force loading frontend styles on selected posts (optionally).

add_action( 'wp_enqueue_scripts', function() {

  // Optionally, limit to only required pages
  $force_loading_post_ids = array( 413 );
  if ( ! in_array( get_the_ID(), $force_loading_post_ids ) ) return;

  if ( ! wp_style_is( 'js_composer_front' ) ) {
    wp_enqueue_style( 'js_composer_front' );
  if ( ! wp_script_is( 'wpb_composer_front_js' ) ) {
    wp_enqueue_script( 'wpb_composer_front_js' );
} );

Don't have WP ACF-VC Bridge yet?

Combine the powers of two giants

Get a must have plugin for modern WordPress website today!


Leave a Reply