* Revert changes made to (HPOS) order editor meta box hooks (original change: PR#51598).

* Restore method param (was inadvertently stripped).

* Provide further explanation re types supplied via `add_meta_boxes`.

* Changelog.
This commit is contained in:
Barry Hughes 2024-10-21 10:17:05 -07:00 committed by GitHub
parent aeade9d9ac
commit 92063b0817
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 30 deletions

View File

@ -1,4 +0,0 @@
Significance: patch
Type: fix
Fixes possible TypeError in orders edit page where wrong parameter type is passed to `add_meta_boxes` action.

View File

@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: We are removing a change previously milestoned for 9.5.0 (as yet unreleased). Therefore, no changelog needed and the original changelog is removed as part of this PR.

View File

@ -12,7 +12,6 @@ use Automattic\WooCommerce\Internal\Admin\Orders\MetaBoxes\TaxonomiesMetaBox;
use Automattic\WooCommerce\Internal\Features\FeaturesController;
use Automattic\WooCommerce\Utilities\OrderUtil;
use WC_Order;
use WP_Post;
/**
* Class Edit.
@ -156,37 +155,29 @@ class Edit {
$this->add_order_specific_meta_box();
$this->add_order_taxonomies_meta_box();
$order_post = get_post( $this->order->get_id() );
if ( $order_post instanceof WP_Post ) {
/**
* From wp-admin/includes/meta-boxes.php.
*
* Fires after all built-in meta boxes have been added. Custom metaboxes may be enqueued here.
*
* @since 3.8.0.
*/
do_action( 'add_meta_boxes', $this->screen_id, $order_post );
/**
* Provides an opportunity to inject custom meta boxes into the order editor screen. This
* hook is an analog of `add_meta_boxes_<POST_TYPE>` as provided by WordPress core.
*
* @since 7.4.0
*
* @param WP_Post $order_post The order being edited.
*/
do_action( 'add_meta_boxes_' . $this->screen_id, $order_post );
}
/**
* From wp-admin/includes/meta-boxes.php.
*
* Fires after all built-in meta boxes have been added. Custom metaboxes may be enqueued here.
*
* Note that the documentation for this hook (and for the corresponding 'add_meta_boxes_<SCREEN_ID>' hook)
* suggest that a post type will be supplied for the first parameter, and and an instance of WP_Post will be
* supplied as the second parameter. We are not doing that here, however WordPress itself also deviates from
* this in respect of comments and (though now less relevant) links.
*
* @since 3.8.0.
*/
do_action( 'add_meta_boxes', $this->screen_id, $this->order );
/**
* Provides an opportunity to inject custom meta boxes into the order editor screen.
* Provides an opportunity to inject custom meta boxes into the order editor screen. This
* hook is an analog of `add_meta_boxes_<POST_TYPE>` as provided by WordPress core.
*
* @since 9.5.0
* @since 7.4.0
*
* @param WC_Order $order The order being edited.
*/
do_action( 'woocommerce_order_editor_add_meta_boxes', $this->order );
do_action( 'add_meta_boxes_' . $this->screen_id, $this->order );
$this->enqueue_scripts();
}