Support » Plugin: Scripts To Footer » Need to keep certain java in the header!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Joshua David Nelson


    Glad it’s working for you, and that is something that is totally achievable! There is a filter to keep specific scripts in the footer. You’ll need the script’s handle or slug used when it’s enqueued. If you don’t know it, you’ll need to either search for the wp_enqueue_script in the plugin files or contact the plugin developer.

    There’s an example on the main plugin page as well as the documentation. Basically, it would look something like this placed in your functions.php file:

    add_filter( 'stf_exclude_scripts', 'stf_custom_header_scripts', 10, 1 );
    function stf_custom_header_scripts( $scripts ) {
        $scripts[] = 'revolution-slider'; // replace 'revolution-slider' with the CORRECT script slug/handle
        return $scripts;

    This should place all dependencies for the slider in the header as well, so if it needs jQuery to run properly, jQuery will also be placed in the header – in the correct order. No need to check the “keep jQuery in the header” box in that scenario (though it should still work either way). Of course, that’s only if the revolution slider script is enqueued properly.

    You might also want to see this support post if the above doesn’t quite work for you – if there are in-line scripts being placed in the wp_head hook it might not print out as expected.

    Hope that helps – let me know if you have any other questions or issues.


    Plugin Author Joshua David Nelson


    gurusurfer, I’m hoping/guessing this worked for you, since it’s been a month I’m going to mark this topic as resolved. Reach out if there are any issues, though!




    I have a question, how can we add multiple slugs? I tried adding them as in example below, but it returned a syntax error.

    $scripts[] = 'strx-magic-floating-sidebar-maker', 'debounce';

    Also, at the plugin page and documentation if you mention that we need to add those codes to the theme’s functions file, probably it’ll be easier for newbies like me. I spent some time figuring where exactly to place the code. 🙂 And thanks for the plugin.

    Plugin Author Joshua David Nelson


    @gezginrocker We covered this in your support post, correct? Let me know if there were more questions or issues, though.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Need to keep certain java in the header!’ is closed to new replies.