Skip to content

Instantly share code, notes, and snippets.

@jesussuarz
Created August 17, 2025 09:03
Show Gist options
  • Save jesussuarz/8e27d9a85ac6938741422c4256d7da26 to your computer and use it in GitHub Desktop.
Save jesussuarz/8e27d9a85ac6938741422c4256d7da26 to your computer and use it in GitHub Desktop.
Hide Seraphinite Accelerator Banner (WordPress MU-Plugin)

Hide the “Optimized by Seraphinite Accelerator” badge in Wordprress. The snippet does two things:

  1. Replies f to the plugin’s ?seraph_accel_gbnr probe so the badge removes itself.
  2. As a fallback, strips any remaining banner markup from the final HTML.

Easiest way: MU-plugin (loads automatically)

  1. Create the folder if it doesn’t exist:
wp-content/mu-plugins/
  1. Create the file:
wp-content/mu-plugins/hide-seraphinite-banner.php
  1. Paste this code and save:
<?php
/**
 * Plugin Name: Hide Seraphinite Accelerator Banner
 * Description: Oculta el “Optimized by Seraphinite Accelerator”.
 */

// Responde al probe (?seraph_accel_gbnr) para que el propio script elimine el banner
add_action('init', function () {
    if (isset($_GET['seraph_accel_gbnr'])) {
        header('Content-Type: text/plain; charset=utf-8');
        header('Cache-Control: no-store, max-age=0');
        echo 'f';
        exit;
    }
}, 0);

// Plan B: si igual aparece en el HTML final, lo borramos
add_filter('seraph_accel_content', function ($html) {
    $html = preg_replace('~<a[^>]*>(?:\s*<img[^>]*>)?\s*<span[^>]*>\s*Optimized by Seraphinite Accelerator\b.*?</a>~is', '', $html);
    $html = preg_replace('~<script[^>]*seraph-accel-crit="1"[^>]*>.*?\?seraph_accel_gbnr.*?</script>~is', '', $html);
    return $html;
}, 9999);
  1. Clear caches (plugin/server/CDN).
  2. Quick test: open https://your-domain/?seraph_accel_gbnr — it should print f.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment