WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Filter wp_head() function

[Resolved] Filter wp_head() function

  • I have 3 plugins (form, chat, poll) that carry a 10 javascripts (ajax) and that makes the site very slow.
    However, only use those plugins in 2 pages of my blog.

    How to configure function wp_head() to load some plugins on some pages only?
    Example: if you only use the chat plugin page id 12, then only that page loads the js, css and all dependent on this plugin, to work.

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi

    See if this article will be helpful

    How to disable scripts and styles

    Thank you for the answer, the article is really good, but left me with a question:
    I need to change the plugin files?
    I can’t just add a function to display .js or .css plugin only on certain pages (ids)?

    Well if you have to change files for each plugin is bad, because when it updates the plugin, my amendment wears off, right?

    because when it updates the plugin, my amendment wears off, right?

    No, the way the article explains to do it, the amendement does NOT wear off when the plugin updates, because you are not modifying the plugin’s code, you are activating WP code from outside the plugin that affects the plugin’s behavior without being part of the plugin. Unless the plugin developer later changes the name of the files or adds additional files loaded into the head section, you are all set using this method.

    You’re right. I just test the method and it worked perfectly.

    Thank you for referring this great article!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Filter wp_head() function’ is closed to new replies.
Skip to toolbar