<?php
$post_ID = url_to_postid();
echo "ID поста = ". $post_ID;
?>
add_filter( 'user_trailingslashit', 'no_post_slash', 70, 2 );
function no_post_slash( $string, $type ){
global $wp_rewrite;
if( 'post' === $type && $wp_rewrite->using_permalinks() && $wp_rewrite->use_trailing_slashes )
$string = untrailingslashit( $string );
return $string;
}