jetpack_images_pre_get_images

Filters the array of images that would be good for a specific post.

Description

apply_filters( 'jetpack_images_pre_get_images', (array) $media, (int) $post_id, (array) $args ); 

This filter is applied before options ($args) filter the original array.

Parameters (3)

0. $media (array)
Array of images that would be good for a specific post.
1. $post_id (int)
The post id.
2. $args (array)
Array of options to get images.

Usage

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

Defined (1)

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

/class.jetpack-post-images.php  
  1. $media = apply_filters( 'jetpack_images_pre_get_images', $media, $post_id, $args );