Yeah, I was looking for this too.
If it’s a too big a request to integrate into the plugin right now is there conditional statements that we could write into the script that should do this.
https://wordpress.stackexchange.com/questions/213742/how-to-load-js-and-css-only-on-specific-pages-using-is-page
if(is_page($page_selected)){
add_action('wp_enqueue_scripts', 'custom_function');
}
@kingfisher64’s example is a good one.
The other way is to simply add this line to the beginning of the snippet:
if ( ! is_page( 'Page Name' ) ) return;
You can replace 'Page Name'
with the title, slug, or ID of the page you want to run the snippet on.
This has worked well for me in the past. It has the benefit of being able to address multiple pages in one go by using an array. You can use either the post/page ID, or the title.
add_action( 'wp_footer', 'Run_On_My_Pages' );
function Run_On_My_Pages() {
if ( is_page( array( 492, 'Page Name', 'Another page Name', 968 ) ) ) {
//Do your stuff here
}
}