Skip to content

Commit

Permalink
Update class-tools.php
Browse files Browse the repository at this point in the history
  • Loading branch information
nk-o committed Oct 8, 2024
1 parent d61b27f commit 47ea1e4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions classes/class-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ public function duplicate_block( $block_id ) {
'post_name' => $post_name,
'post_parent' => $post->post_parent,
'post_password' => $post->post_password,
// we must set the status to publish for the slug generation function (wp_unique_post_slug) to work correctly.
// We must set the status to publish for the slug generation function (wp_unique_post_slug) to work correctly.
'post_status' => 'publish',
'post_title' => $post->post_title,
'post_type' => $post->post_type,
Expand Down Expand Up @@ -690,8 +690,8 @@ public function duplicate_block( $block_id ) {
$meta_value = maybe_unserialize( $meta_value );

if ( 'lazyblocks_slug' === $meta_key ) {
$new_post = get_post( $new_post_id );
// Now when cloning a block, we change its slug to a unique one, using the standard functionality of WordPress.
// Copy new post slug to meta.
$new_post = get_post( $new_post_id );
$meta_value = $new_post->post_name;
}

Expand All @@ -700,7 +700,7 @@ public function duplicate_block( $block_id ) {
}
}

// change the status to draft after all manipulations with the slug.
// Change the status to draft after all manipulations with the slug.
wp_update_post(
array(
'post_type' => $post->post_type,
Expand Down

0 comments on commit 47ea1e4

Please sign in to comment.