/*Reverse sticky header*/

Hide the View Source of your WordPress site

How to Hide View Source of Your WordPress Site

Introduction

By default, WordPress does not offer a built-in way to disable “View Source,” “Inspect,” or right-click functionality in visitors’ browsers. To add this protection layer, you can install a third-party plugin—Disable Source, Disable Right Click, and Content Protection—which blocks common ways to access your site’s HTML, CSS, and JavaScript.

Install the Plugin

  1. In your WordPress dashboard, go to Plugins > Add New.
  2. Search for Disable Source, Disable Right Click, and Content Protection.
  3. Click Install Now, then Activate.

Configure Protection Settings

  1. Navigate to Settings > Content Protection in your dashboard.
  2. Under General Options, enable:
    • Disable Right Click
    • Disable View Source / Inspect Element
  3. (Optional) Enable Block Keyboard Shortcuts to prevent shortcuts like Ctrl+U or Cmd+Option+U.
  4. Click Save Changes.

Verify the Protection

  1. Visit your site in an incognito/private browser window.
  2. Right-click anywhere on the page—context menus should be disabled.
  3. Attempt to use “View Page Source” (Ctrl+U/Cmd+Option+U) or open DevTools (F12)—the plugin should block these actions or redirect you.

Troubleshooting and FAQs

Q: I can still view source by disabling JavaScript—why?
A: This protection relies on JavaScript. Disabling JS in the browser bypasses it. True source hiding isn’t possible because the browser must download HTML to render the page.

Q: Some elements still show in DevTools—how can I block them?
A: Complete protection isn’t guaranteed. Consider server-side measures (e.g., obfuscating inline scripts) and ensure the plugin’s most recent version is active.

Q: Will this plugin affect site performance or SEO?
A: Minimal impact. The plugin adds a small JS script. Your content and metadata remain crawlable by search engines, as they don’t rely on client-side right-click protection.

Q: Can I customize the block message or redirect?
A: Yes—under Settings > Content Protection, you can set a custom URL or message when users attempt blocked actions.

Q: Is this a foolproof way to protect my code?
A: No. Determined users can still view source via server logs or by intercepting network traffic. This plugin deters casual copying and source viewing but doesn’t replace proper code security.

Was this article helpful?

Related Articles

Subscribe to Our Newsletter

Stay In Touch

Subscribe to our Newsletter, and we’ll send you the latest news from BuddyBoss

  • This field is hidden when viewing the form
  • This field is for validation purposes and should be left unchanged.

To speak to our Agency consultant, fill in the form found at our Contact Page.

"*" indicates required fields

Get Started

Enter your name and email address to get started with your project...

Name*
Profile photo of
Not recently active