Revisions: Clean up _wp_post_revision_fields():

* Move the array processing to a new function, `_wp_post_revision_data()`.
* Make both functions accept a post array or a `WP_Post` object. 
* Always apply the `_wp_post_revision_fields` filter and pass the post data to it.

Fixes #13382.

git-svn-id: https://develop.svn.wordpress.org/trunk@36659 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2016-02-24 00:43:31 +00:00
parent 50a4dd92ac
commit 45017abf02
5 changed files with 76 additions and 49 deletions
+2 -2
View File
@@ -340,7 +340,7 @@ class Tests_Post_Revisions extends WP_UnitTestCase {
$post = self::factory()->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content' ) );
$post = (array) $post;
$post_revision_fields = _wp_post_revision_fields( $post );
$post_revision_fields = _wp_post_revision_data( $post );
$post_revision_fields = wp_slash( $post_revision_fields );
$revision_ids = array();
@@ -368,7 +368,7 @@ class Tests_Post_Revisions extends WP_UnitTestCase {
$post = self::factory()->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content' ) );
$post = (array) $post;
$post_revision_fields = _wp_post_revision_fields( $post );
$post_revision_fields = _wp_post_revision_data( $post );
$post_revision_fields = wp_slash( $post_revision_fields );
$revision_ids = array();