From 213091155af382f5c27f30a1065f49996aa50555 Mon Sep 17 00:00:00 2001 From: Ruben Ramirez Date: Thu, 3 Apr 2025 20:29:10 -0500 Subject: [PATCH] Update to filesystem path instead of URL --- src/Admin/JobMetaboxes.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Admin/JobMetaboxes.php b/src/Admin/JobMetaboxes.php index 9e546fe..4edf522 100644 --- a/src/Admin/JobMetaboxes.php +++ b/src/Admin/JobMetaboxes.php @@ -112,13 +112,14 @@ class JobMetaboxes { global $post_type; if ( 'job' === $post_type && ( 'post.php' === $hook_suffix || 'post-new.php' === $hook_suffix ) ) { - $script_path = plugin_dir_url( QUIZTECH_PLUGIN_FILE ) . 'admin/js/job-metabox.js'; + $script_url = plugin_dir_url( QUIZTECH_PLUGIN_FILE ) . 'admin/js/job-metabox.js'; + $script_local_path = plugin_dir_path( QUIZTECH_PLUGIN_FILE ) . 'admin/js/job-metabox.js'; // File system path $script_asset_path = plugin_dir_path( QUIZTECH_PLUGIN_FILE ) . 'admin/js/job-metabox.asset.php'; - $script_asset = file_exists( $script_asset_path ) ? require( $script_asset_path ) : [ 'dependencies' => [], 'version' => filemtime( plugin_dir_path( QUIZTECH_PLUGIN_FILE ) . $script_path ) ]; + $script_asset = file_exists( $script_asset_path ) ? require( $script_asset_path ) : [ 'dependencies' => [], 'version' => file_exists( $script_local_path ) ? filemtime( $script_local_path ) : QUIZTECH_VERSION ]; // Use filemtime with local path wp_enqueue_script( 'quiztech-job-metabox-script', - $script_path, + $script_url, // Use the URL here for enqueuing array_merge( $script_asset['dependencies'], [ 'jquery' ] ), // Add jquery dependency $script_asset['version'], true // Load in footer