It’s not clear if you’re trying to load these files on frontend or backend.
For the backend I usually do this:
define('MY_PLUGIN_DIR_URL', plugin_dir_url(__FILE__));
//LOAD ADMIN/BACKEND CSS STYLES
add_action('admin_enqueue_scripts', 'my_plugin_enqueue_style_and_scripts', 99);
function my_plugin_enqueue_style_and_scripts() {
$timestamp = time();
wp_enqueue_style('my-plugin-backend', MY_PLUGIN_DIR_URL.'/css/style.css', false, $timestamp, 'all');
wp_enqueue_script( 'my-plugin-backend', MY_PLUGIN_DIR_URL.'/js/script.js', array( 'signature' ), $timestamp, true );
}
You doesn’t need to call “plugin_dir_url(FILE)” every time, define a constant once and the code will be more clean.
Concerning your issue: You’re saying the source show the properly version in query string but the browser still load the prevoius one?
First of all, disable every caching way in your environment.
Some plugins like LiteSpeed use to cache ESI object even in backend.