Update to filesystem path instead of URL

This commit is contained in:
Ruben Ramirez 2025-04-03 20:29:10 -05:00
parent 53c5e2102f
commit 213091155a

View file

@ -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