Added methods to create and edit products

This commit is contained in:
Claudio Sanches 2016-03-29 21:22:10 -03:00
parent a16b32825f
commit 5bf8c808fc
2 changed files with 1111 additions and 10 deletions

View File

@ -235,7 +235,7 @@ abstract class WC_REST_Posts_Controller extends WP_REST_Controller {
$meta_fields = $this->add_post_meta_fields( $post, $request );
if ( is_wp_error( $meta_fields ) ) {
// Remove post.
wp_delete_post( $post->ID, true );
$this->delete_post( $post );
return $meta_fields;
}
@ -269,6 +269,15 @@ abstract class WC_REST_Posts_Controller extends WP_REST_Controller {
return true;
}
/**
* Delete post.
*
* @param WP_Post $post
*/
protected function delete_post( $post ) {
wp_delete_post( $post->ID, true );
}
/**
* Update a single post.
*

File diff suppressed because it is too large Load Diff