WP_PLUGIN_DIR, plugins_url('', WPMU_PLUGIN_DIR . '/dummy') => WPMU_PLUGIN_DIR, get_stylesheet_directory_uri() => get_stylesheet_directory(), get_template_directory_uri() => get_template_directory(), content_url() => WP_CONTENT_DIR, site_url('/' . WPINC) => ABSPATH . WPINC, ); } $filename = null; foreach($url_mappings as $root_url => $directory) { if ( strpos($url, $root_url) === 0 ) { $filename = $directory . '/' . substr($url, strlen($root_url)); //Get rid of the query string, if any. list($filename, ) = explode('?', $filename, 2); break; } } return $filename; } /** * Apply automatic versioning to all scripts and style sheets added using WP dependency APIs. * * If you set $add_ver_to_filename to TRUE, make sure to also add the following code to your * .htaccess file or your site may break: * * * RewriteEngine On * RewriteRule ^(.*)\.[\d]{10}\.(css|js)$ $1.$2 [L] * * * @static * @param bool $add_ver_to_filename */ public static function apply_to_all_dependencies($add_ver_to_filename = false) { self::$version_in_filename = $add_ver_to_filename; foreach(array('script_loader_src', 'style_loader_src') as $hook) { add_filter($hook, __CLASS__ . '::_filter_dependency_src', 10, 1); } } public static function _filter_dependency_src($src) { //Only add version info to CSS/JS files that don't already have it in the file name. if ( preg_match('@(?