How to restrict your WordPress website only to view through mobile devices

Mobile Devices

You might think this topic looks a little odd. Why would someone need to hide the website for desktop users? There could be number of reasons for doing so.

  • The site is not designed for larger screens
  • You want to force users to use their mobile devices to access your mobile pages.
  • Site was intended by the client only to be used on mobile devices.

By using this plugin available below, you can enable/disable desktop users who are accessing pages/posts easily. But this does not hinder your ability to operate backend through your desktop web browser.

With few lines of code, you can build this plug in. You can find in depth details how to write a Wordpress Plugin here or read more about practical sample under Wordpress essentials section here.

What you can do with this plug-in

  • It makes easy for you to enable/disable this feature.
  • You also can use the same logic and include this to your theme function file. But then you will lose the feature to enable/disable it from your wordpress backend. So it is up to you to take the right decision according to the project requirement.
  • Important thing to note is that you cannot use this plugin to secure your contents from desktop users. If you know how to change your browser agent, you will be able to access blocked pages from your desktop browsers as some browsers allow you to switch browser agents.

You can download the full source code here.


Share this with


2 comment(s) for "How to restrict your WordPress website only to view through mobile devices"

  1. Navneet

    Posted on 12 August 2013 at 09:51 AM

    Hi dude ,
    Its a nice post but actually, I am looking for just opposite for this article ...I want to restrict my wordpress site not to open in mobile and devices....I just want that my site only accessible through desktop/laptop...

    any Idea ,,,,please....


  2. Navneet Singh

    Posted on 21 August 2013 at 01:36 PM

    Nice Post ,.. I looking for same ... thanks a lot for sharing ...

    Navneet Singh


Post a comment

Thank you! Your comment will be posted after it is approved.
Sorry! Something went wrong. Please try again.