infinite_scroll_additional_scripts

Filter the additional scripts required by the latest set of IS posts.

Description

apply_filters( 'infinite_scroll_additional_scripts', (array) $results_scripts, (array|bool) $initial_scripts, (array) $results, (array) $query_args, (WP_Query) $wp_query ); 

Parameters (5)

0. $results_scripts (array)
Additional scripts required by the latest set of IS posts.
1. $initial_scripts (array|bool)
Set of scripts loaded on each page.
2. $results (array)
Array of Infinite Scroll results.
3. $query_args (array)
Array of Query arguments.
4. $wp_query (WP_Query)
The wp query.

Usage

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

Defined (1)

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

/modules/infinite-scroll/infinity.php  
  1. $results['scripts'] = apply_filters(