Wordpress CSS and JS Version Numbers Not Working

≡放荡痞女 提交于 2019-12-01 22:03:33

问题


I am trying to figure out why the version number query string is not being included in any of my JS or CSS files that I set. I have looked through all documentation and tried different methods. I have even tried just removing the version and Wordpress won't add it's own version. Was hoping to get any other ideas to try from someone so I can cache break Cloudflare easier.

wp_enqueue_style( 'theme-stylesheet', get_template_directory_uri() . '/assets/css/style.css', false, '1.0' );

wp_register_script( 'theme-scripts', get_template_directory_uri() . '/assets/js/blacklab.min.js', array( 'jquery' ), '1.0.2', true );
wp_localize_script( 'theme-scripts', 'localVar', $stream_info );
wp_enqueue_script( 'theme-scripts' );

回答1:


Odds are that you have a plugin or theme function that is removing the query variable. It's impossible to guess where it might be without seeing your code, but if it was built properly, you should be able to search your plugins and theme folders for:

  • remove_query_arg: Which is the function used to remove the ver string.
  • script_loader_src: The hook which is often used to run the above function.


来源:https://stackoverflow.com/questions/36805009/wordpress-css-and-js-version-numbers-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!