• Resolved agg2

    (@agg2)


    The problem is that enqueing script this way, I end up inadvertently targeting product pages and other pages also which use the?post?and?post-new?hook, as WordPress has many types of posts, not only orders. I?only?want to target Woocommerce view individual order and create new order admin pages. (Not orders list, just individual orders.)

    function selectively_enqueue_admin_script_js_for_edit_address( $hook ) {
    if ( 'post.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 / / During development, you could avoid the hassle of clearing the browser cache by passing a dynamic variable as the file's version when you enqueue it. For instance, the current time. */
    }
    add_action( 'admin_enqueue_scripts', 'selectively_enqueue_admin_script_js_for_edit_address' );

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How can I specifically enqueue scripts for edit orders pages only’ is closed to new replies.