Few important Variables in WordPress

  • Avinash
  • 0
  • Jul 24, 2014
  • Tips & Tricks

WordPress is very good at extending functionality using plugins and good amount of action hook and filter hooks. When you look at core of WordPress it has many variables available which can help them (WordPress Team but in fact its available to us as well) to make code conditionally based on various browser type and server type.

In this article we will see various variable which are available to detect various things like browser, mobile and webserver in WordPress. We will go one by one below:

Important WordPress Variables

Browser Detection Variables in WordPress

Here are list of Browser Detection variables which will filled with TRUE when one of the following browser is detected else it will filled with FALSE.

  1. $is_lynx To detect Lynx Browser in WordPress
  2. $is_gecko To detect Gecko Browser in WordPress
  3. $is_IE To detect Internet Explorer Browser in WordPress
  4. $is_winIE To detect Windows IE Browser in WordPress
  5. $is_macIE To detect Mac IE Browser in WordPress
  6. $is_opera To detect Opera Browser in WordPress
  7. $is_NS4 To detect NS4 Browser in WordPress
  8. $is_safari To detect Safari Browser in WordPress
  9. $is_chrome To detect Chrome Browser in WordPress
  10. $is_iphone To detect iPhone Browser in WordPress

Web Server Detection Variables in WordPress

Here are lists of Web Server Detection variables in WordPress.

  1. $is_apache: To detect Apache in WordPress
  2. $is_nginx: To detect NgINX in WordPress
  3. $is_IIS: To detect IIS in WordPress
  4. $is_iis7: To detect IIS7 in WordPress

Mobile Detection Variable in WordPress

This particular variable $is_mobile will set to TRUE when user is browsing website from mobile else it will be set to FALSE.
So this is the list which I have listed all variables which I have collected so far. Let me know if you have any more variables which are available in WordPress and not a part of this article.

Related Posts

Written by Avinash

Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.

View all posts by: