The McLuhan Theme Search Icon Bug (caused by Bogo Plugin) — and How I Fixed It

The Problem

If you use the McLuhan WordPress theme on a site with the Bogo multilingual plugin active, you may have noticed that the search icon (magnifying glass) in the bottom-left footer doesn’t show up and instead a link icon appears. And if you click on it, instead of opening the search overlay, the site redirects you to https://www.example.com/?s showing an empty search results page.

Without Bogo, the theme works normally: the href stays ?s= and the icon appears. The issue only arises when Bogo is active.

How I Found the Root Cause (Three Layers of the Same Bug)

The starting point: Bogo truncates the URL

The code in header.php is correct:

<a href="<?php echo home_url('?s='); ?>">

On a normal site, this produces:

<a href="https://www.netlabor.it/?s="></a>

But when the Bogo plugin is active, it rewrites URLs for language switching and in the process drops the =, turning ?s= into ?s. The resulting HTML is:

<a href="https://www.netlabor.it/?s"></a>

This is what triggers the bug.

1. CSS side: the icon never renders

In style.css at line 867, a CSS attribute selector is used to render the Font Awesome icon:

a[href*="?s="]::before {
    content: "\f002"; /* magnifying glass */
}

The selector a[href*="?s="] looks for an href containing the string ?s=. But since Bogo changed the href to ?s (no =), no element is matched and the icon never appears.

2. JS side: the click handler never binds

In assets/js/global.js at line 57:

$('a[href$="?s="]').on('click', function(e) {
    e.preventDefault();
    // open search overlay
});

Again, a[href$="?s="] (ends-with) doesn’t match ?s, so the click is never intercepted and the browser navigates normally to the empty search page.

Why Bogo does this

Bogo is a multilingual plugin that rewrites URLs to manage languages. When it passes the URL through its normalization logic, it strips the = from empty-valued parameters. This behavior is specific to Bogo — on other sites (without Bogo), the href stays ?s= and everything works as expected.

The Fix: Create a Child Theme and Modify There

The solution is simple: instead of matching ?s= or ?s separately, use a selector that matches both forms. Just change = to * (the “contains” selector).

Important: never modify files directly in the parent theme. Use a child theme for two reasons:

  • Parent theme updates won’t overwrite your changes
  • JavaScript files from the parent theme are NOT automatically loaded by the child theme — you must dequeue and re-enqueue them

Step 1: Create the child theme structure

Create the folder mcluhan-child/ with these two files:

mcluhan-child/style.css

/*
 Theme Name:   McLuhan Child
 Template:     mcluhan
 Description:  Child theme to fix the search icon bug with Bogo
 Version:      1.0
*/

mcluhan-child/functions.php

<?php

// Load the parent theme's stylesheet first
add_action('wp_enqueue_scripts', 'mcluhan_child_enqueue_parent_styles', 10);
function mcluhan_child_enqueue_parent_styles() {
    wp_enqueue_style('mcluhan-style', get_template_directory_uri() . '/style.css');
}

// Then load the child theme's stylesheet
add_action('wp_enqueue_scripts', 'mcluhan_child_enqueue_child_styles', 20);
function mcluhan_child_enqueue_child_styles() {
    wp_enqueue_style('mcluhan-child-style', get_stylesheet_directory_uri() . '/style.css');
}

// CRITICAL: dequeue the parent's JS and re-enqueue from the child theme
// Otherwise the buggy parent version keeps loading
add_action('wp_enqueue_scripts', 'mcluhan_child_enqueue_scripts', 30);
function mcluhan_child_enqueue_scripts() {
    wp_dequeue_script('mcluhan_global');
    wp_enqueue_script(
        'mcluhan_global',
        get_stylesheet_directory_uri() . '/assets/js/global.js',
        array('jquery'),
        '1.0.1', // corrected version
        true
    );
}

Step 2: Copy and modify assets/js/global.js

Copy assets/js/global.js from the parent theme into mcluhan-child/assets/js/global.js and change these two lines:

Line 57 — main click handler

// BEFORE:
$('a[href$="?s="]').on('click', function(e) {
    e.preventDefault();
    // open search overlay
});

// AFTER:
$('a[href*="?s"]').on('click', function(e) {
    e.preventDefault();
    // open search overlay
});

Line 73 — alternate handler

// BEFORE:
$('a[href$="?s="]').on('click', function(e) {
    e.preventDefault();
    // other action
});

// AFTER:
$('a[href*="?s"]').on('click', function(e) {
    e.preventDefault();
    // other action
});

Step 3: Copy and modify style.css

Copy style.css from the parent theme into mcluhan-child/style.css (overwriting the one from step 1) and change line 867:

/* BEFORE: */
a[href*="?s="]::before {
    content: "\f002";
    /* ... icon styles */
}

/* AFTER: */
a[href*="?s"]::before {
    content: "\f002";
    /* ... icon styles */
}

Step 4: Activate the child theme

In the WordPress admin, go to Appearance → Themes and activate McLuhan Child.

Summary of Changes

FileChange
mcluhan-child/functions.phpDequeue and re-enqueue JS from child theme
mcluhan-child/assets/js/global.js (line 57)a[href$="?s="] → a[href*="?s"]
mcluhan-child/assets/js/global.js (line 73)a[href$="?s="] → a[href*="?s"]
mcluhan-child/style.css (line 867)a[href*="?s="]::before → a[href*="?s"]::before

[href*="?s"] means “whose href contains ?s“. This matches both ?s and ?s=, making the theme robust regardless of how Bogo (or any other plugin) formats the URL.

Why This Article Matters

This bug is a great example of how a seemingly minor issue (a missing character in a URL) can manifest in three different layers (PHP → CSS → JS) and be amplified by a third-party plugin. The fix takes seconds, but without knowing where to look, it can feel like a mystery.

If you found this on your own site, I hope these lines save you some time.

Leave a Reply