Viewing 1 replies (of 1 total)
  • I patched the Loader.php file has:

    
    public static function activate_frontend_scripts() : void {
            global $post;
    
    		if ( \is_a( $post, 'WP_Post' ) && \has_shortcode( $post->post_content, 'mail_encrypt' ) ) {
                wp_enqueue_script(
                    'mail_encrypt.js',
                    self::$base . 'dist/js/mail-encrypt-frontend.js',
                    [],
                    null,
                    true
                );
            }
        }

Viewing 1 replies (of 1 total)
  • The topic ‘Enqueue JS only where shortcode is used’ is closed to new replies.