Disable Theme Switching

Hire Now!

Whether you’re looking to launch your brand, showcase your portfolio, or open an online store, we’re here to bring your ideas to life.

  • Post Created: 1 week ago
  • Views: 1

Disable Theme Switching

Reading Time: 1 Minute

Understanding the Hook: stylesheet

The stylesheet filter allows you to prevent users from switching themes programmatically.

Why Use This Hook?

  • Lock the site to a specific theme.
  • Prevent accidental changes to theme settings.

How It Works

Return the desired theme slug regardless of the user’s selection.

Code Example

function lock_theme_switching($stylesheet) {
    return 'your-locked-theme-slug';
}
add_filter('stylesheet', 'lock_theme_switching');

Discussion