Skip to content
Advertisement

WordPress Plugin JS remove version

Hello I want to include my js file without adding ?ver=x.x.x to it I tried all the solutions but nothing help me to get the success

Here is my Code I am trying to add

add_action( 'wp_enqueue_scripts', 'register_script');
function register_script() {
    wp_enqueue_script( 'customJS', plugins_url( '/assets/script.js', __FILE__ ), false);
}

Output it returns

<script src='http://localhost/wordpress/myplugin/assets/script.js?ver=5.4.4'></script>

Output I need

<script src='http://localhost/wordpress/myplugin/assets/script.js'></script>

Advertisement

Answer

Version is set by 4th param, use NULL, more info at https://developer.wordpress.org/reference/functions/wp_enqueue_script/.

wp_enqueue_script( 'customJS', plugins_url( '/assets/script.js', __FILE__ ), false, NULL);
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement