Index: src/wp-includes/class-wp-xmlrpc-server.php
===================================================================
--- src/wp-includes/class-wp-xmlrpc-server.php	(revision 39951)
+++ src/wp-includes/class-wp-xmlrpc-server.php	(working copy)
@@ -1378,6 +1378,22 @@
 			$post_data['edit_date'] = true;
 		}
 
+		/**
+		 * Filter XML-RPC data to be added/updated via XML-RPC before any DB insertion
+		 *
+		 * @since 4.8
+		 *
+		 * @param array   $post_data       Parsed array of post data.
+		 * @param array   $content_struct  Post data array.
+		 * @param WP_User $user            WP_User object.
+		 * 
+		 * @return array|IXR_Error
+		 */
+		$post_data = apply_filters( 'xmlrpc_before_insert_post', $post_data, $content_struct, $user );
+		if ( $post_data instanceof IXR_Error ) {
+			return $post_data;
+		}
+
 		if ( ! isset( $post_data['ID'] ) )
 			$post_data['ID'] = get_default_post_to_edit( $post_data['post_type'], true )->ID;
 		$post_ID = $post_data['ID'];
Index: tests/phpunit/tests/xmlrpc/wp/newPost.php
===================================================================
--- tests/phpunit/tests/xmlrpc/wp/newPost.php	(revision 39951)
+++ tests/phpunit/tests/xmlrpc/wp/newPost.php	(working copy)
@@ -372,5 +372,33 @@
 		$this->assertStringMatchesFormat( '%d', $result );
 		$this->assertEquals( $date_string , $fetched_post->post_date_gmt );
 	}
+	
+	/**
+	 * @ticket
+	 */
+	function test_xmlrpc_before_insert_post () {
+		$this->make_user_by_role( 'editor' );
 
+		// Add filter 
+		add_filter( 'xmlrpc_before_insert_post', array( $this, 'filter_xmlrpc_before_insert_post' ), 10, 3 );
+
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', array( 'post_title' => 'Too short', 'custom_fields' => array( array( 'key' => 'custom_field_to_create', 'value' => '123456789' ) ) ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 500, $result->code );
+		$this->assertEquals( 'Post title too short.', $result->message );
+
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', array( 'post_title' => 'Right title', 'custom_fields' => array( array( 'key' => 'custom_field_to_create', 'value' => '123456789' ) ) ) ) );
+		$fetched_post = get_post( $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+		$this->assertEquals( 'Right title', $fetched_post->post_title );
+	}
+
+	function filter_xmlrpc_before_insert_post ( $post_data, $content_struct, $user  ) {
+
+		if ( strlen( $post_data['post_title'] ) < 10 ) {
+			return new \IXR_Error( 500, 'Post title too short.' );
+		}
+		return $post_data;
+	}
+
 }
Index: tests/phpunit/tests/xmlrpc/wp/editPost.php
===================================================================
--- tests/phpunit/tests/xmlrpc/wp/editPost.php	(revision 39951)
+++ tests/phpunit/tests/xmlrpc/wp/editPost.php	(working copy)
@@ -437,4 +437,39 @@
 		$future_date_string = strftime( '%Y-%m-%d %H:%M:%S', $future_time );
 		$this->assertEquals( $future_date_string, $after->post_date );
 	}
+
+	/**
+	 * @ticket
+	 */
+	function test_xmlrpc_before_insert_post () {
+		$this->make_user_by_role( 'editor' );
+
+		$post_id = self::factory()->post->create( array(
+			'post_title'   => 'Post title',
+			'post_content' => 'Post edited',
+			'post_status'  => 'draft',
+			'post_type'    => 'post'
+		) );
+
+		// Add filter 
+		add_filter( 'xmlrpc_before_insert_post', array( $this, 'filter_xmlrpc_before_insert_post' ), 10, 3 );
+
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, array( 'post_title' => 'Too short' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 500, $result->code );
+		$this->assertEquals( 'Post title too short.', $result->message );
+
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, array( 'post_title' => 'Right title' ) ) );
+		$fetched_post = get_post( $post_id );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertTrue($result);
+		$this->assertEquals( 'Right title', $fetched_post->post_title );
+	}
+
+	function filter_xmlrpc_before_insert_post ( $post_data, $content_struct, $user  ) {
+		if ( strlen( $post_data['post_title'] ) < 10 ) {
+			return new \IXR_Error( 500, 'Post title too short.' );
+		}
+		return $post_data;
+	}
 }
