Only output function from functions.php if conditional tag is true
Move the is_tax() conditional inside the slug_scripts_masonry function. function slug_scripts_masonry() { if ( is_tax() ) { wp_enqueue_script( ‘masonry’ ); wp_enqueue_style( ‘masonry’, get_template_directory_uri().’/css/’ ); } } add_action( ‘wp_enqueue_scripts’, ‘slug_scripts_masonry’ ); Because WordPress has not yet executed the code which determines the result of is_tax() it will return false on all pages.