Overriding a function in wordpress

A theme that I bought is adding unnecessary inline JS code that is not needed in the front page.

/* Scripts - dynamic css */
    add_action('wp_footer', 'upme_custom_scripts');
    function upme_custom_scripts(){
        require_once upme_path . 'js/upme-custom-js.php';
    }

I would like to add to my custom.js file an override so that I dont have to edit the core file in case it gets updated. Can this be achieved? if so please show me

I was thinking about overriding the function then registering and en-queueing the js file, but i dont know how to override it.

Thanks

1 Answer
1

Remove the action:

add_action('wp_footer', 'remove_upme_script', 0 );

function remove_upme_script()
{
    remove_action('wp_footer', 'upme_custom_scripts');
}

Leave a Comment