• Hola,
    He estado viendo la velocidad de mi web en PageSpeed Insights y me recomienda eliminar javaScript que no estoy utilizando.
    Si alguien me pudiera dar consejo como eliminarlo sin dañar nada más o si existe algún plugin que lo haga sería de gran ayuda.
    La web es prismaticos.org y lo he pasado por https://developers.google.com/speed/pagespeed/insights/
    Muchas gracias de antemano.

    • This topic was modified 5 years, 9 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    No plugin can know if a particular page needs a particular script or not. You’ll need to decide for yourself. It’s not unusual for plugins to load their script for all pages even though it’s only needed for a few because the plugin cannot know if its script is needed or not. The Contact Form 7 script is a good example. It’s only needed on pages that have a contact form, yet the script appears on all pages.

    Plugins should be adding scripts with wp_enqueue_script(). If they do and you can find the code where they do this, you can dequeue the same script in a later action hook if it’s not needed for the requested page.
    https://developer.ww.wp.xz.cn/reference/functions/wp_dequeue_style/

    You can determine the requested page’s ID with get_queried_object_id(). If the ID is not in a list of IDs which need the script, dequeue the script. Getting the queried object ID will not work for archive type pages which list multiple posts. You can check if the request is for such a page with is_archive().

Viewing 1 replies (of 1 total)

The topic ‘Eliminar recursos JavaScript’ is closed to new replies.