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:
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.
- [code]$is_lynx[/code] To detect Lynx Browser in WordPress
- [code]$is_gecko[/code] To detect Gecko Browser in WordPress
- [code]$is_IE[/code] To detect Internet Explorer Browser in WordPress
- [code]$is_winIE[/code] To detect Windows IE Browser in WordPress
- [code]$is_macIE[/code] To detect Mac IE Browser in WordPress
- [code]$is_opera[/code] To detect Opera Browser in WordPress
- [code]$is_NS4[/code] To detect NS4 Browser in WordPress
- [code]$is_safari[/code] To detect Safari Browser in WordPress
- [code]$is_chrome[/code] To detect Chrome Browser in WordPress
- [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.
- [code]$is_apache[/code]: To detect Apache in WordPress
- [code]$is_nginx[/code]: To detect NgINX in WordPress
- [code]$is_IIS[/code]: To detect IIS in WordPress
- [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.