Looking to add /post (or any other like /blog)after the domain name in the permalink URLs of your WordPress site’s single blog posts?

Follow these steps, thanks to AI (tested and working).
Other post types won’t be affected.
Step 1
Add the following in child theme‘s functions.php (w/o the opening PHP tag) or a code snippets plugin:
<?php
/**
* Add '/post' to single blog post permalinks
*
* @param string $permalink The permalink URL.
* @param WP_Post $post The post object.
* @param bool $leavename Whether to keep the post name.
* @return string Modified permalink URL.
*/
function bl_modify_post_permalink( string $permalink, WP_Post $post, bool $leavename ): string {
// Only modify permalinks for the 'post' post type
if ( $post->post_type !== 'post' ) {
return $permalink;
}
// Don't modify if permalink is empty or post is not published
if ( empty( $permalink ) || $post->post_status !== 'publish' ) {
return $permalink;
}
// Get the home URL
$home_url = home_url();
// If permalink doesn't contain the home URL, return the original
if ( strpos( $permalink, $home_url ) === false ) {
return $permalink;
}
// Extract the path part of the permalink
$path = str_replace( $home_url, '', $permalink );
// Check if '/post/' is already in the permalink
if ( strpos( $path, '/post/' ) !== false ) {
return $permalink;
}
// Add '/post' to the permalink
$modified_permalink = $home_url . '/post' . $path;
return $modified_permalink;
}
add_filter( 'post_link', 'bl_modify_post_permalink', 10, 3 );
/**
* Update rewrite rules to handle the modified permalinks
*/
function bl_add_post_rewrite_rules(): void {
add_rewrite_rule(
'^post/([^/]+)(?:/([0-9]+))?/?$',
'index.php?name=$matches[1]&page=$matches[2]',
'top'
);
}
add_action( 'init', 'bl_add_post_rewrite_rules' );
/**
* Flush rewrite rules on plugin activation
* Note: Only call this once or during plugin activation
*/
function bl_flush_rewrite_rules(): void {
bl_add_post_rewrite_rules();
flush_rewrite_rules();
}
// Uncomment the line below to flush rewrite rules once
add_action( 'wp_loaded', 'bl_flush_rewrite_rules' );
If you’d like to add /blog instead, use this snippet instead.
Step 2
Visit any page of the site on the frontend and refresh it.
Step 3
Change
add_action( 'wp_loaded', 'bl_flush_rewrite_rules' );
to
// add_action( 'wp_loaded', 'bl_flush_rewrite_rules' );