Only include the plugin files on specific pages

By default the Custom Facebook Feed plugin will include it’s CSS and JavaScript file on every page, as, due to browser caching, once the files are loaded once by the user then they will be cached for every subsequent page load.  Nonetheless, you can choose to only include the plugin CSS and JavaScript files only on specific pages by adding the following to your theme’s functions.php file:

add_action( 'wp_enqueue_scripts', 'remove_cff_resources', 20 );
function remove_cff_resources() {
	if( !is_page(array( 'news', 'blog' )) ){

This will remove the plugin files on every page apart from pages with the slug or ‘news’ or ‘blog’. You can also specify the ID or page title instead of the slug. See here for examples of how to use the WordPress “is_page” function.


Couldn’t find your answer in the docs?

Contact Support