Blocs 6.4.7 – Duplicate jQuery Loading in WordPress Theme Export

Hi @Norm ,

I’ve been optimizing a WordPress theme generated with Blocs 6.4.7 (Bootstrap 5) and noticed that jQuery appears to be loaded twice in several exported templates, even though I haven’t manually added jQuery to the project.

In the generated functions/enqueue-scripts.php, Blocs registers and enqueues its bundled jQuery:

wp_enqueue_script(
    'jquery',
    get_template_directory_uri() . '/js/jquery.min.js',
    array(),
    '8425',
    false
);

However, several generated page templates, including index.php, category.php, tag.php, search.php, and page-contactus.php, also contain a direct script reference under the <!-- Additional JS --> section:

<script src="<?php echo get_template_directory_uri(); ?>/js/jquery.min.js"></script>

This potentially causes jQuery to be downloaded or executed twice on those pages, bypassing WordPress’s script dependency management.

What I’ve checked:

  • There is no manually attached jQuery file that I can find in the Blocs project.

  • The project’s internal exportSettings contain includeJquery = false and jquery = 1.

  • Nevertheless, jQuery is included both through WordPress’s enqueue system and through direct script tags in several exported templates.

Expected behavior:

For WordPress exports, jQuery should ideally be loaded only once, through wp_enqueue_script(), with no additional direct references in the generated page templates.

Could you check whether this is an issue with the WordPress exporter, or whether there’s a project setting I’m overlooking?

I’d also be interested in whether Blocs could use WordPress’s registered jQuery instead of deregistering it and loading its own copy, provided this wouldn’t affect Blocs-generated JavaScript functionality.

Let me know if you need additional information.

Thanks.

Ricardo

1 Like