How to restrict your WordPress website only to view through mobile devices
2 February, 2013
Tags : WordPress, Mobile, PHP
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"
Post a comment