Try this: add_action('template_redirect', 'add_scripts'); function add_scripts() { if ( ! is_page() ) return; global $posts; if ( FALSE === strpos($posts[0]->post_content, '[your_shortcode') ) return; wp_enqueue_script(... } -- http://scribu.net