Title: Scripts To Footer
Author: Joshua David Nelson
Published: <strong>27 Janeiro, 2013</strong>
Last modified: 17 Novembro, 2025

---

Procurar plugins

![](https://ps.w.org/scripts-to-footerphp/assets/banner-772x250.jpg?rev=833162)

![](https://s.w.org/plugins/geopattern-icon/scripts-to-footerphp_fcfefd.svg)

# Scripts To Footer

 Por [Joshua David Nelson](https://profiles.wordpress.org/joshuadnelson/)

[Descarregar](https://downloads.wordpress.org/plugin/scripts-to-footerphp.0.7.3.zip)

 * [Detalhes](https://pt.wordpress.org/plugins/scripts-to-footerphp/#description)
 * [Avaliações](https://pt.wordpress.org/plugins/scripts-to-footerphp/#reviews)
 *  [Instalação](https://pt.wordpress.org/plugins/scripts-to-footerphp/#installation)
 * [Desenvolvimento](https://pt.wordpress.org/plugins/scripts-to-footerphp/#developers)

 [Suporte](https://wordpress.org/support/plugin/scripts-to-footerphp/)

## Descrição

This small plugin moves scripts to the footer. Note that this only works if you 
have plugins and a theme that utilizes `wp_enqueue_scripts` correctly.

You can disable the plugin on specific pages and posts directly via the post/page
edit screen metabox.

You can disable the plugin on specific archive pages (blog page, search page, post
type and taxonomy archives) via the settings page.

**Everything Broken?** Try placing jQuery back into the header via Settings > Scripts
to Footer, “Keep jQuery in the Header” checkbox. If that doesn’t work, refer to 
the walkthrough below for using the `stf_exclude_scripts` filter for the script 
that is causing the issue.

Check out the [documentation](https://github.com/joshuadavidnelson/scripts-to-footer/wiki)
on [GitHub](https://github.com/joshuadavidnelson/scripts-to-footer) or some quick
walkthroughs below.

#### Keeping specific Scripts in the Header

As of version 0.6 you can now keep specific scripts in the header. Note: this will
print any scripts they depend on as well (if you want to keep `jquery-effects-core`
in the header, you’ll also get `jQuery` in the header, so no need to add both).

Specifically for jQuery, see the settings page option, as it is a common request
we’ve built it into the settings.

For any other scripts, use this filter:

    ```
    add_filter( 'stf_exclude_scripts', 'jdn_header_scripts', 10, 1 );
    function jdn_header_scripts( $scripts ) {

        $scripts[] = 'backbone'; // Replace 'backbone' with the script slug

        return $scripts;
    }
    ```

You will need the correct script slug, which is used when the script is registered,
and the script will only be printed into the header _if it’s enqueued_. Check out
the scripts that come registered [out-of-the-box with WordPress](https://codex.wordpress.org/Function_Reference/wp_enqueue_script#Default_Scripts_Included_and_Registered_by_WordPress).

**Note:** As of version 0.6.3, [conditional tags](https://codex.wordpress.org/Conditional_Tags)
will work with the `stf_exclude_scripts` filter.

#### Custom Post Type Support

If you’re comfortable with code you can use the `scripts_to_footer_post_types` filter
to change the post types this applies to (it only applies to pages and posts by 
default). For example, if you have a custom post type called “project” you could
add support for this metabox via the post type filter like this:

    ```
    function stf_add_cpt_support( $post_types ) {

        $post_types[] = 'project';

        return $post_types;
    }
    add_filter( 'scripts_to_footer_post_types', 'stf_add_cpt_support' );
    ```

#### Excluding Pages/Posts/Templates Via Filter

You can either use the checkbox option to disable the plugin’s action on a specific
page/post, or you can utilize a filter. The filter also passes the post/page id,
if there is one (archive templates don’t have ids!).

For example, for the “page” post type:

    ```
    function stf_exclude_my_page( $exclude_page, $post_id ) {

        if ( is_front_page() ) {
            $exclude_page = 'on'; // this turns on the "exclude" option
        }

        return $exclude_page;
    }
    add_filter( 'stf_page', 'stf_exclude_my_page' );
    ```

Replace `stf_page` with `stf_post` for posts, or the slug of your custom post type.
For instance, a post type called “project” can be filtered with `stf_project`.

#### More Documentation

[See the plugin’s wiki](https://github.com/joshuadavidnelson/scripts-to-footer/wiki).

#### Development / Contributing

[View this plugin on GitHub](https://github.com/joshuadavidnelson/scripts-to-footer).

#### Support

Please feel free to open a [Github Issue](https://github.com/joshuadavidnelson/scripts-to-footer/issues)
to report conflicts or goto [the WP.org support forum](https://wordpress.org/support/plugin/scripts-to-footerphp).
If there is something wrong with Scripts-to-Footer, we’ll update it. However, if
it’s a another plugin or theme we can only contact the developer with the issue 
to attempt to resolve it.

## Ecrãs

 * [[
 * The metabox that shows up on the Edit screen.
 * [[
 * The settings page.

## Instalação

This section describes how to install the plugin and get it working.

e.g.

 1. Upload `scripts-to-footer.php` to the `/wp-content/plugins/` directory
 2. Active o plugin no menu Plugins
 3. You can disable the plugin on specific pages or posts via a checkbox.

## Perguntas frequentes

### My scripts are not moving to the footer.

This is likely due to one of three things:
 – The theme you’re using is not enqueuing
scripts per [WordPress standards](https://codex.wordpress.org/Function_Reference/wp_enqueue_script#Using_a_Hook).–
You have a plugin that is not enqueuing scripts [per standards](https://codex.wordpress.org/Function_Reference/wp_enqueue_script#Using_a_Hook).–(
Less common) There is a conflict with this plugin and another one. Deactivate all
plugins and revert to a built-in theme (like TwentyTwelve or TwentyFifteen). Then
activate Scripts-to-Footer. Check your HTML source to confirm it’s working. If so,
proceed to activate each of your other plugins one at a time, checking your HTML
source each time to see if the scripts behavior changes. Eventually you’ll find 
a conflict, if not with the plugins then activate your theme and check.

### Everything Breaks!!

There are lots of scripts that require things like jQuery in the header. Try checking
the “Keep jQuery in the header” option in Settings > Scripts to Footer or using 
the `stf_exclude_scripts` filter noted in the [documentation](https://github.com/joshuadavidnelson/scripts-to-footer/wiki)(
Note: only for version 0.6 and higher).

### My Slider stopped working

See number “Everything Breaks!!” above. Try checking the “Keep jQuery in the header”
option in Settings > Scripts to Footer or using the `stf_exclude_scripts` filter
noted in the [documentation](https://github.com/joshuadavidnelson/scripts-to-footer/wiki)

### My Page Speed hasn’t improved (or it’s worse)

This plugin should not change your actual page _speed_ – the same scripts are being
loaded, that takes the same amount of time. However, by placing scripts in the footer
you can change the _precieved_ load times, moving [render-blocking scripts](https://developers.google.com/speed/docs/insights/BlockingJS)
below the fold, allowing your content to load first – instead of loading scripts
and slowing the visual portions of your site. That’s the whole point. Outside of
that, this plugin is not intended to increase page load speed or minify scripts 
in anyway.

## Avaliações

![](https://secure.gravatar.com/avatar/590c1a85322729f2345aa128684db6522b37951ea328215b6f501ed8439c0a91?
s=60&d=retro&r=g)

### 󠀁[Jquery to footer without hassle!](https://wordpress.org/support/topic/jquery-to-footer-without-hassle/)󠁿

 [Jimmy Lee](https://profiles.wordpress.org/shirtguy72/) 31 Março, 2023 1 resposta

Move jquery to my footer with no issues, have been researching and seemed to be 
near impossible. Should have checked the Repository first! Scripts to Footer is 
a GREAT plugin! Thanks SO much!

![](https://secure.gravatar.com/avatar/35229879cd7f7ef9fb67479e02189b1874ac0f4110b52090a6998129f5566902?
s=60&d=retro&r=g)

### 󠀁[Brilliant](https://wordpress.org/support/topic/brilliant-1429/)󠁿

 [321abc](https://profiles.wordpress.org/deraxia/) 21 Junho, 2021 1 resposta

Works perfectly and has all the options you could possibly want from a load scripts
in footer plugin.

![](https://secure.gravatar.com/avatar/8e2eed85aec3b0ea553f4459ff9fd7c7b2e49a028d1e1e6a4f2b788f2980d2d2?
s=60&d=retro&r=g)

### 󠀁[Great option “Keep jQuery in the Header”](https://wordpress.org/support/topic/great-option-keep-jquery-in-the-header/)󠁿

 [Tom](https://profiles.wordpress.org/thommen/) 29 Julho, 2019

This is great idea.

![](https://secure.gravatar.com/avatar/369a37b9f2228c3ed744f39a3a4878326eaa517135b0fd7cc0e8430a516af628?
s=60&d=retro&r=g)

### 󠀁[Perfectly improving the speed of page load](https://wordpress.org/support/topic/perfectly-improving-the-speed-of-page-load/)󠁿

 [LELB Society](https://profiles.wordpress.org/lelb/) 25 Junho, 2019 1 resposta

After installing this plugin, I noticed my site being loaded quite faster. This 
plugin is a miracle worker. I use SG Optimizer and needed to use a plugin that does
not have any conflict with SG Optimizer. After doing so much research, I finally
came across this one.

![](https://secure.gravatar.com/avatar/2f7c5ce9d489acd7dd993c2665af62a93a90f7872a2114bc9e8ec02bc9e09acb?
s=60&d=retro&r=g)

### 󠀁[Buen plugin](https://wordpress.org/support/topic/buen-plugin-87/)󠁿

 [asgard8](https://profiles.wordpress.org/asgard8/) 14 Janeiro, 2019 1 resposta

Yo lo utilizo en mi site y va genial, principalmente lo puede usar con sites sin
scripts en sliders y demás.

![](https://secure.gravatar.com/avatar/048f63c782ae9f991869729a4af77cda33d604e56cdaac756b0ddfd5299fd133?
s=60&d=retro&r=g)

### 󠀁[Very good plugin.](https://wordpress.org/support/topic/very-good-plugin-1257/)󠁿

 [rifel](https://profiles.wordpress.org/rifel/) 13 Setembro, 2018

Thanks to the author

 [ Ler todas as 36 avaliações ](https://wordpress.org/support/plugin/scripts-to-footerphp/reviews/)

## Contribuidores e programadores

“Scripts To Footer” é software de código aberto. As seguintes pessoas contribuíram
para este plugin:

Contribuidores

 *   [ Joshua David Nelson ](https://profiles.wordpress.org/joshuadnelson/)

[Traduza o “Scripts To Footer” para o seu idioma.](https://translate.wordpress.org/projects/wp-plugins/scripts-to-footerphp)

### Interessado no desenvolvimento?

[Consulte o código](https://plugins.trac.wordpress.org/browser/scripts-to-footerphp/),
consulte o [repositório SVN](https://plugins.svn.wordpress.org/scripts-to-footerphp/),
ou subscreva o [registo de alterações](https://plugins.trac.wordpress.org/log/scripts-to-footerphp/)
por [RSS](https://plugins.trac.wordpress.org/log/scripts-to-footerphp/?limit=100&mode=stop_on_copy&format=rss).

## Registo de alterações

#### 0.7.3

 * Tested up to WordPress 6.8.3
 * Add composer support
 * Update github actions

#### 0.7.2

 * Tested up to WordPress 6.4.2.
 * Bump minimum WordPress version to 5.3, aligning with minimum PHP support.
 * A bunch of code tidy, fix coding standards, typos, and CI. h/t @szepeviktor
 * Add github actions

#### 0.7.1

 * Remove duplicated plugin header to fix fresh install error.

#### 0.7.0

 * Update tested WP up to 6.1.1
 * Update minimum PHP to 7.4
 * Restructuring files to match plugin boilerplate structure.

#### 0.6.4.1

 * Update Github Action to publish from github to WP.org.

#### 0.6.4

 * Removed unnecessary logging functions and added a debug check before logging 
   anything.
 * Tidy up code spacing and inline-documentation.
 * Added `STF_DEBUG` for use in error logging function with `WP_DEBUG`, both must
   be `true` before error logging is output to the debug.log file.

#### 0.6.3

Moved the ‘set_header_scripts’ function into a ‘wp_head’ add_action to allow for
conditional checks to work within the ‘stf_exclude_scripts’ filter.

#### 0.6.2

Added support for disabling plugin on 404 pages, thanks to Alex (@piscis on GitHub)

#### 0.6.1

Updates custom taxonomy check for custom taxonomy archives and some error logging
functions.

#### 0.6.0

Large number of improvements:
 – Add settings page with global disable options for
home page, search pages, post type archives, taxonomy archives, and other archives.–
Update uninstall.php to remove things correctly. – Add FAQ to readme.txt and readme.
md. – Add a changelog as a separate file. – Change the custom post type filter. 
Refer to updated [FAQ](https://github.com/joshuadavidnelson/scripts-to-footer/#faq)
and [documentation](https://github.com/joshuadavidnelson/scripts-to-footer/wiki).–
Add support for custom taxonomy archives. – Change the exclude filter, to be more
relevant to the new options. Older filter is deprecated, but still supported for
backwards compatibility. – Update the post meta for disabling the plugin on specific
posts/pages. – Add Github Updater support. – Removed CMB and built metaboxes the
old fashion way. – Added debug logging to better track any potential errors moving
forward.

#### 0.5

Reverted metabox version to previous – invalid error was sneaking through.

#### 0.4

Added filter to exclude pages, updated metabox version, plugin version bump and 
updated readme.txt file.

#### 0.3

Added conditional to disable on plugin on admin dashboard, version bump.

#### 0.2

Updating code to be object-oriented and added page metabox to disable plugin on 
specific pages.

#### 0.1

Release inicial

## Metadados

 *  Versão **0.7.3**
 *  Última actualização **Há 5 meses**
 *  Instalações activas **8.000+**
 *  Versão do WordPress ** 5.3 ou superior **
 *  Testado até **6.8.5**
 *  Versão do PHP ** 7.4 ou superior **
 *  Idioma
 * [English (US)](https://wordpress.org/plugins/scripts-to-footerphp/)
 * Etiquetas
 * [footer](https://pt.wordpress.org/plugins/tags/footer/)[head](https://pt.wordpress.org/plugins/tags/head/)
   [javascript](https://pt.wordpress.org/plugins/tags/javascript/)[performance](https://pt.wordpress.org/plugins/tags/performance/)
   [speed](https://pt.wordpress.org/plugins/tags/speed/)
 *  [Visualização avançada](https://pt.wordpress.org/plugins/scripts-to-footerphp/advanced/)

## Classificações

 4.7 out of 5 stars.

 *  [  34 5-star reviews     ](https://wordpress.org/support/plugin/scripts-to-footerphp/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/scripts-to-footerphp/reviews/?filter=4)
 *  [  1 3-star review     ](https://wordpress.org/support/plugin/scripts-to-footerphp/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/scripts-to-footerphp/reviews/?filter=2)
 *  [  2 1-star reviews     ](https://wordpress.org/support/plugin/scripts-to-footerphp/reviews/?filter=1)

[Adicionar a minha avaliação](https://wordpress.org/support/plugin/scripts-to-footerphp/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/scripts-to-footerphp/reviews/)

## Contribuidores

 *   [ Joshua David Nelson ](https://profiles.wordpress.org/joshuadnelson/)

## Suporte

Tem algo a dizer? Precisa de ajuda?

 [Ver fórum de suporte](https://wordpress.org/support/plugin/scripts-to-footerphp/)

## Doar

Gostaria de apoiar o desenvolvimento deste plugin?

 [ Fazer donativo para o plugin ](https://joshuadnelson.com/donate/)