diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php index 4036b2bbce..37ab30721d 100644 --- a/src/wp-admin/includes/post.php +++ b/src/wp-admin/includes/post.php @@ -681,6 +681,16 @@ function bulk_edit_posts( $post_data = null ) { } } + /** + * Fires after processing the post data for bulk edit. + * + * @since 6.3.0 + * + * @param int[] $updated An array of updated post IDs. + * @param array $shared_post_data Associative array containing the post data. + */ + do_action( 'bulk_edit_posts', $updated, $shared_post_data ); + return array( 'updated' => $updated, 'skipped' => $skipped, diff --git a/tests/phpunit/tests/admin/includesPost.php b/tests/phpunit/tests/admin/includesPost.php index 07660e6f30..ec72c68f6d 100644 --- a/tests/phpunit/tests/admin/includesPost.php +++ b/tests/phpunit/tests/admin/includesPost.php @@ -318,6 +318,31 @@ class Tests_Admin_IncludesPost extends WP_UnitTestCase { } } + /** + * Tests that `bulk_edit_posts()` fires the 'bulk_edit_posts' action. + * + * @ticket 28112 + * + * @covers ::bulk_edit_posts + */ + public function test_bulk_edit_posts_should_fire_bulk_edit_posts_action() { + wp_set_current_user( self::$admin_id ); + + $action = new MockAction(); + add_action( 'bulk_edit_posts', array( $action, 'action' ) ); + + bulk_edit_posts( + array( + 'post' => self::$post_id, + 'post_type' => 'post', + '_status' => 1, + + ) + ); + + $this->assertSame( 1, $action->get_call_count() ); + } + /** * @ticket 38293 */