Title: Feature Request: Add filter for function shouldLoadJavascript
Last modified: August 20, 2016

---

# Feature Request: Add filter for function shouldLoadJavascript

 *  Resolved [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/feature-request-add-filter-for-function-shouldloadjavascript/)
 * First thank you for your work on this plugin! I have a feature request to propose.
   Right now infinite scroll only loads on non-singular pages. I need to use it 
   in a page template ( the template is listing all the site’s authors ) that is
   being used in an archive kind of way.
 * If there were a filter in the shouldLoadJavascript() function I think this would
   work out while being completely backwards compatible.
 *     ```
       function shouldLoadJavascript() {
       		// Don't need to load the plugin on single pages
       		if (is_singular()) {
       			return false;
       		}
   
       		return true;
       	}
       ```
   
 *     ```
       function shouldLoadJavascript() {
   
       		$load = true;
   
       		// Don't need to load the plugin on single pages
       		if (is_singular()) {
       			$load = false;
       		}
   
       		return apply_filters( 'infinite_scroll_load_javascript', $load );
       	}
       ```
   
 * [http://wordpress.org/extend/plugins/infinite-scroll/](http://wordpress.org/extend/plugins/infinite-scroll/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Andrew Tibbetts](https://wordpress.org/support/users/andrewgtibbetts/)
 * (@andrewgtibbetts)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/feature-request-add-filter-for-function-shouldloadjavascript/#post-3373215)
 * bump
 *  Thread Starter [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/feature-request-add-filter-for-function-shouldloadjavascript/#post-3373216)
 * Andrew,
 * I think this thread died, but I think this is actually in the code. If this version
   isn’t in the WP repo you can get it from github:
 * [https://github.com/paulirish/infinite-scroll](https://github.com/paulirish/infinite-scroll)
 *     ```
       /**
       	 * Determines if the jQuery plugin and corresponding options should
       	 * be output onto the page.
       	 *
       	 * @return bool
       	 */
       	function shouldLoadJavascript() {
       		// Don't need to load the plugin on single pages
       		$load = is_single() ? false : true;
       		return apply_filters( 'infinite_scroll_load_javascript', $load );
       	}
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Feature Request: Add filter for function shouldLoadJavascript’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/infinite-scroll.svg)
 * [Infinite-Scroll](https://wordpress.org/plugins/infinite-scroll/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/infinite-scroll/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/infinite-scroll/)
 * [Active Topics](https://wordpress.org/support/plugin/infinite-scroll/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/infinite-scroll/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/infinite-scroll/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/feature-request-add-filter-for-function-shouldloadjavascript/#post-3373216)
 * Status: resolved