# Remove the Core Version From Script and Style URLs

> Strips ?ver= from front-end CSS and JavaScript URLs when it equals the WordPress version, hiding it from the page source. Plugin and theme versions are left alone.

- Type: PHP
- Runs: Frontend only
- Category: [Security](https://wpide.com/library/category/security/)
- Tags: security, version, assets
- Author: WPIDE Team
- Installs: 6
- Updated: 2026-10-28
- Page: https://wpide.com/library/remove-core-version-from-assets/

## Code

```php
$wpide_strip_core_version = function ( $src ) {
    if ( ! is_string( $src ) || false === strpos( $src, 'ver=' ) ) {
        return $src;
    }

    $query = (string) wp_parse_url( $src, PHP_URL_QUERY );
    parse_str( $query, $args );

    if ( isset( $args['ver'] ) && get_bloginfo( 'version' ) === $args['ver'] ) {
        $src = remove_query_arg( 'ver', $src );
    }

    return $src;
};

add_filter( 'style_loader_src', $wpide_strip_core_version, 9999 );
add_filter( 'script_loader_src', $wpide_strip_core_version, 9999 );
```

## Notes

After a WordPress update, browsers may keep cached core files a little longer.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Remove the Core Version From Script and Style URLs" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
