pre_jetpack_is_mobile

Filter the value of jetpack_is_mobile before it is calculated.

Description

apply_filters( 'pre_jetpack_is_mobile', (null) $null, (string) $kind, (bool) $return_matched_agent ); 

Passing a truthy value to the filter will short-circuit determining the mobile type, returning the passed value instead.

Parameters (3)

0. $null (null) => null
Boolean if current UA matches $kind or not. If $return_matched_agent is true, should return the UA string
1. $kind (string)
Category of mobile device being checked
2. $return_matched_agent (bool)
Boolean indicating if the UA should be returned

Usage

To run the hook, copy the example below.
  1. $null = apply_filters( 'pre_jetpack_is_mobile', $null, $kind, $return_matched_agent ); 
  2.  
  3. if ( !empty( $null ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the pre_jetpack_is_mobile callback 
  2. function filter_pre_jetpack_is_mobile( $null, $kind, $return_matched_agent ) { 
  3. // make filter magic happen here... 
  4. return $null
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'pre_jetpack_is_mobile', 'filter_pre_jetpack_is_mobile', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'pre_jetpack_is_mobile', 'filter_pre_jetpack_is_mobile', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/class.jetpack-user-agent.php  
  1. $pre = apply_filters( 'pre_jetpack_is_mobile', null, $kind, $return_matched_agent );