The issue is that enqueing script this manner, I find yourself inadvertently concentrating on product pages and different pages additionally which use the publish
and post-new
hook, as WordPress has many forms of posts, not solely orders. I solely wish to goal Woocommerce view particular person order and create new order admin pages. (Not orders record, simply particular person orders.)
perform selectively_enqueue_admin_script_js_for_edit_address( $hook ) {
if ( 'publish.php' != $hook and 'post-new.php' != $hook ) {
return;
}
wp_enqueue_script( 'artio-wc-admin-order-page-mod', '/wp-content/plugins/custom_wc_mods/order_page/paste_payment_instructions_and_prompts_into_shipping_address_form_v2.js', array(), date("h:i:s") );
/* https://stackoverflow.com/a/31834007 */
/* Throughout improvement, you would keep away from the trouble of clearing the browser cache by passing a dynamic variable because the file's model once you enqueue it. As an illustration, the present time. */
}
add_action( 'admin_enqueue_scripts', 'selectively_enqueue_admin_script_js_for_edit_address' );