Added methods to create and edit products
This commit is contained in:
parent
a16b32825f
commit
5bf8c808fc
|
@ -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
Loading…
Reference in New Issue