Tips & Tricks

Few important Variables in WordPress

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. [code]$is_lynx[/code] To detect Lynx Browser in WordPress
  2. [code]$is_gecko[/code] To detect Gecko Browser in WordPress
  3. [code]$is_IE[/code] To detect Internet Explorer Browser in WordPress
  4. [code]$is_winIE[/code] To detect Windows IE Browser in WordPress
  5. [code]$is_macIE[/code] To detect Mac IE Browser in WordPress
  6. [code]$is_opera[/code] To detect Opera Browser in WordPress
  7. [code]$is_NS4[/code] To detect NS4 Browser in WordPress
  8. [code]$is_safari[/code] To detect Safari Browser in WordPress
  9. [code]$is_chrome[/code] To detect Chrome Browser in WordPress
  10. [code]$is_iphone[/code] To detect iPhone Browser in WordPress

[gads]

Web Server Detection Variables in WordPress

Here are lists of Web Server Detection variables in WordPress.

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

Mobile Detection Variable in WordPress

This particular variable [code]$is_mobile[/code] will set to [code]TRUE[/code] when user is browsing website from mobile else it will be set to [code]FALSE[/code].
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.

Shares:

Leave a Reply

Your email address will not be published. Required fields are marked *