if ( !
$post->post_name
) { wp_update_post( array
( 'ID' =>
$post_id,
'post_name' => 'custom_slug_' .
uniqid(),
) );
} $terms =
get_the_terms( $post_id, 'wp_theme'
);
if ( !
is_array( $terms ) || !
count( $terms ) ) { wp_set_post_terms( $post_id,
get_stylesheet(), 'wp_theme'
);
}}/**
* Generates a unique slug for templates.
*
* @access private
* @since 5.8.0
*
* @param string $override_slug The filtered value of the slug (starts as `null` from apply_filter).
* @param string $slug The original/un-filtered slug (post_name).
* @param int $post_id Post ID.
* @param string $post_status No uniqueness checks are made if the post is still draft or pending.
* @param string $post_type Post type.
* @return string The original, desired slug.
*/