Untitled

 avatar
unknown
plain_text
11 days ago
1.3 kB
4
Indexable
// Fix Bootstrap conflict only on B2BKing admin page
function fix_bootstrap_conflict() {
    // Check if we're on the B2BKing admin page
    $current_page = isset($_GET['page']) ? $_GET['page'] : '';
    if ($current_page !== 'b2bking') {
        return;
    }
    
    // Dequeue the specific Bootstrap script from Stockholm theme
    wp_dequeue_script('bootstrap');
    wp_deregister_script('bootstrap');
    
    // Additional possible handles to try if the above doesn't work
    $possible_handles = ['bootstrap-js', 'stockholm-bootstrap', 'qode-bootstrap'];
    foreach ($possible_handles as $handle) {
        wp_dequeue_script($handle);
        wp_deregister_script($handle);
    }
    
    // Direct path dequeue
    add_filter('script_loader_tag', 'remove_specific_bootstrap', 10, 2);
}
add_action('admin_enqueue_scripts', 'fix_bootstrap_conflict', 100);

// Function to remove the specific bootstrap.min.js file by its URL
function remove_specific_bootstrap($tag, $handle) {
    // Check if we're on the B2BKing admin page
    $current_page = isset($_GET['page']) ? $_GET['page'] : '';
    if ($current_page !== 'b2bking') {
        return $tag;
    }
    
    if (strpos($tag, 'stockholm/framework/admin/assets/js/bootstrap.min.js') !== false) {
        return '';
    }
    return $tag;
}
Editor is loading...
Leave a Comment