{"id":1132,"date":"2012-09-09T18:18:17","date_gmt":"2012-09-10T01:18:17","guid":{"rendered":"http:\/\/www.virendrachandak.com\/techtalk\/\/?p=1132"},"modified":"2013-10-06T15:45:53","modified_gmt":"2013-10-06T22:45:53","slug":"how-to-remove-wordpress-version-parameter-from-js-and-css-files","status":"publish","type":"post","link":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/","title":{"rendered":"How to remove WordPress version parameter from JS and CSS files"},"content":{"rendered":"<p>In my last post I mentioned <a href=\"http:\/\/www.virendrachandak.com\/techtalk\/\/how-to-remove-wordpress-version-number\/\" title=\"How to remove WordPress version number\" target=\"_blank\">how we can remove WordPress version number<\/a> from the page source and RSS feeds. However, they are not the only places where we can identify the WordPress version number. Many CSS and JS files in the WordPress also have the WordPress version number appended to their source. In this post I will show how we can remove the version number from them too.<\/p>\n<p>We can use one of the following 2 methods. Just added the code for one of the below methods in your theme&#8217;s functions.php file. The first method removes the &#8220;ver&#8221; parameter from all the enqueued CSS and JS files. The 2nd method removes the &#8220;ver&#8221; parameter only if its value matches the WordPress version number.<br \/>\n<!--more--><br \/>\n<span style=\"text-decoration: underline;\">Method 1<\/span>: Remove the &#8220;ver&#8221; parameter from all enqueued CSS and JS files<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/ remove wp version param from any enqueued scripts\r\nfunction vc_remove_wp_ver_css_js( $src ) {\r\n    if ( strpos( $src, 'ver=' ) )\r\n        $src = remove_query_arg( 'ver', $src );\r\n    return $src;\r\n}\r\nadd_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 );\r\nadd_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 );\r\n<\/pre>\n<p><span style=\"text-decoration: underline;\">Method 2<\/span>: Remove only the &#8220;ver&#8221; parameter which have WordPress version number from all enqueued CSS and JS files<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/ remove wp version param from any enqueued scripts\r\nfunction vc_remove_wp_ver_css_js( $src ) {\r\n    if ( strpos( $src, 'ver=' . get_bloginfo( 'version' ) ) )\r\n        $src = remove_query_arg( 'ver', $src );\r\n    return $src;\r\n}\r\nadd_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 );\r\nadd_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 );\r\n<\/pre>\n<p>Using one of the above functions combined with one of the methods mentioned in my previous post (<a href=\"http:\/\/www.virendrachandak.com\/techtalk\/\/how-to-remove-wordpress-version-number\/\" title=\"How to remove WordPress version number\" target=\"_blank\">How to remove WordPress version number<\/a>) will remove the WordPress version from most of the places on your site.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my last post I mentioned how we can remove WordPress version number from the page source and RSS feeds. However, they are not the only places where we can identify the WordPress version number. Many CSS and JS files in the WordPress also have the WordPress version number appended to their source. In this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[91],"tags":[124,101],"class_list":["post-1132","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-snippets","tag-wordpress-version"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to remove WordPress version parameter from JS and CSS files - Virendra&#039;s Techtalk<\/title>\n<meta name=\"description\" content=\"In my last post I mentioned how we can remove WordPress version number from the page source and RSS feeds. However, they are not the only places where we\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to remove WordPress version parameter from JS and CSS files - Virendra&#039;s Techtalk\" \/>\n<meta property=\"og:description\" content=\"In my last post I mentioned how we can remove WordPress version number from the page source and RSS feeds. However, they are not the only places where we\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/\" \/>\n<meta property=\"og:site_name\" content=\"Virendra&#039;s TechTalk\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:published_time\" content=\"2012-09-10T01:18:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-10-06T22:45:53+00:00\" \/>\n<meta name=\"author\" content=\"Virendra Chandak\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:site\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virendra Chandak\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/\"},\"author\":{\"name\":\"Virendra Chandak\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17\"},\"headline\":\"How to remove WordPress version parameter from JS and CSS files\",\"datePublished\":\"2012-09-10T01:18:17+00:00\",\"dateModified\":\"2013-10-06T22:45:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/\"},\"wordCount\":313,\"commentCount\":26,\"publisher\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17\"},\"keywords\":[\"snippets\",\"WordPress version\"],\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/\",\"url\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/\",\"name\":\"How to remove WordPress version parameter from JS and CSS files - Virendra's Techtalk\",\"isPartOf\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#website\"},\"datePublished\":\"2012-09-10T01:18:17+00:00\",\"dateModified\":\"2013-10-06T22:45:53+00:00\",\"description\":\"In my last post I mentioned how we can remove WordPress version number from the page source and RSS feeds. However, they are not the only places where we\",\"breadcrumb\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"TechTalk\",\"item\":\"https:\/\/www.virendrachandak.com\/techtalk\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress\",\"item\":\"https:\/\/www.virendrachandak.com\/techtalk\/category\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to remove WordPress version parameter from JS and CSS files\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#website\",\"url\":\"https:\/\/www.virendrachandak.com\/techtalk\/\",\"name\":\"Virendra's TechTalk\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.virendrachandak.com\/techtalk\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17\",\"name\":\"Virendra Chandak\",\"logo\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/www.virendrachandak.com\",\"https:\/\/www.facebook.com\/virendrachandak\",\"https:\/\/www.linkedin.com\/in\/virendrachandak\/\",\"https:\/\/x.com\/virendrachandak\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to remove WordPress version parameter from JS and CSS files - Virendra's Techtalk","description":"In my last post I mentioned how we can remove WordPress version number from the page source and RSS feeds. However, they are not the only places where we","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/","og_locale":"en_US","og_type":"article","og_title":"How to remove WordPress version parameter from JS and CSS files - Virendra's Techtalk","og_description":"In my last post I mentioned how we can remove WordPress version number from the page source and RSS feeds. However, they are not the only places where we","og_url":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/","og_site_name":"Virendra&#039;s TechTalk","article_publisher":"https:\/\/www.facebook.com\/virendrachandak","article_author":"https:\/\/www.facebook.com\/virendrachandak","article_published_time":"2012-09-10T01:18:17+00:00","article_modified_time":"2013-10-06T22:45:53+00:00","author":"Virendra Chandak","twitter_card":"summary_large_image","twitter_creator":"@virendrachandak","twitter_site":"@virendrachandak","twitter_misc":{"Written by":"Virendra Chandak","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/#article","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/"},"author":{"name":"Virendra Chandak","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"headline":"How to remove WordPress version parameter from JS and CSS files","datePublished":"2012-09-10T01:18:17+00:00","dateModified":"2013-10-06T22:45:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/"},"wordCount":313,"commentCount":26,"publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"keywords":["snippets","WordPress version"],"articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/","url":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/","name":"How to remove WordPress version parameter from JS and CSS files - Virendra's Techtalk","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website"},"datePublished":"2012-09-10T01:18:17+00:00","dateModified":"2013-10-06T22:45:53+00:00","description":"In my last post I mentioned how we can remove WordPress version number from the page source and RSS feeds. However, they are not the only places where we","breadcrumb":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"TechTalk","item":"https:\/\/www.virendrachandak.com\/techtalk\/"},{"@type":"ListItem","position":2,"name":"WordPress","item":"https:\/\/www.virendrachandak.com\/techtalk\/category\/wordpress\/"},{"@type":"ListItem","position":3,"name":"How to remove WordPress version parameter from JS and CSS files"}]},{"@type":"WebSite","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website","url":"https:\/\/www.virendrachandak.com\/techtalk\/","name":"Virendra's TechTalk","description":"","publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.virendrachandak.com\/techtalk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17","name":"Virendra Chandak","logo":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.virendrachandak.com","https:\/\/www.facebook.com\/virendrachandak","https:\/\/www.linkedin.com\/in\/virendrachandak\/","https:\/\/x.com\/virendrachandak"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2vTtQ-ig","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/1132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/comments?post=1132"}],"version-history":[{"count":0,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/1132\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/media?parent=1132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/categories?post=1132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/tags?post=1132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}