diff options
author | Yury German <blueknight@gentoo.org> | 2022-01-23 18:37:36 -0500 |
---|---|---|
committer | Yury German <blueknight@gentoo.org> | 2022-01-23 18:37:36 -0500 |
commit | f18b23a3a9378fb0a98856d436aa9ebf94e47429 (patch) | |
tree | e418433e22854ebd2d77eaa869d5d0470a973317 /plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-endpoint.php | |
parent | Add classic-editor 1.5 (diff) | |
download | blogs-gentoo-f18b23a3a9378fb0a98856d436aa9ebf94e47429.tar.gz blogs-gentoo-f18b23a3a9378fb0a98856d436aa9ebf94e47429.tar.bz2 blogs-gentoo-f18b23a3a9378fb0a98856d436aa9ebf94e47429.zip |
Updating Classic Editor, Google Authenticatior, Jetpack, Public Post Preview, Table of Contents, Wordpress Importer
Signed-off-by: Yury German <blueknight@gentoo.org>
Diffstat (limited to 'plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-endpoint.php')
-rw-r--r-- | plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-endpoint.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-endpoint.php b/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-endpoint.php index 43d6fe11..07adba9e 100644 --- a/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-endpoint.php +++ b/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-endpoint.php @@ -301,6 +301,16 @@ class WPCOM_JSON_API_Update_Post_Endpoint extends WPCOM_JSON_API_Post_Endpoint { if ( 'publish' === $new_status && 'draft' === $last_status && ! isset( $input['date_gmt'] ) && $date_in_past ) { $input['date_gmt'] = gmdate( 'Y-m-d H:i:s' ); } + + // Untrash a post so that the proper hooks get called as well as the comments get untrashed. + if ( 'trash' === $last_status && 'trash' !== $new_status && isset( $post->ID ) ) { + wp_untrash_post( $post->ID ); + $untashed_post = get_post( $post->ID ); + // Lets make sure that we use the revert the slug. + if ( isset( $untashed_post->post_name ) && $untashed_post->post_name . '__trashed' === $input['slug'] ) { + unset( $input['slug'] ); + } + } } if ( function_exists( 'wpcom_switch_to_locale' ) ) { @@ -705,7 +715,6 @@ class WPCOM_JSON_API_Update_Post_Endpoint extends WPCOM_JSON_API_Post_Endpoint { $meta = (object) $meta; - // Custom meta description can only be set on sites that have a business subscription. if ( Jetpack_SEO_Posts::DESCRIPTION_META_KEY == $meta->key && ! Jetpack_SEO_Utils::is_enabled_jetpack_seo() ) { return new WP_Error( 'unauthorized', __( 'SEO tools are not enabled for this site.', 'jetpack' ), 403 ); } |