mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Quick/Bulk Edit: Add an action hook to bulk_edit_posts() function.
This changeset introduces the `bulk_edit_posts` action hook, triggered after processing the post data for bulk edit and before the function returns its results. For example, it allows developers to save additional data without having to perform any `.ajax()` calls. Follow-up to [8973]. Props helgatheviking, helen, Mte90, afercia, mrasharirfan, desrosj, itowhid06, pento, mensmaximus, audrasjb, costdev, webcommsat, marybaum, oglekler, mukesh27, SergeyBiryukov. Fixes #28112. git-svn-id: https://develop.svn.wordpress.org/trunk@56091 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user