<?php
$url = get_the_permalink();
$post_ID = url_to_postid($url);
echo "ID поста = ". $post_ID;
?>
function pcl_smart_trailingslashit($string) {
/* ensure, that there is one trailing slash */
$string = rtrim($string, '/') . '/';
/* if there is a filename extension like .html or .php, then remove the trailing slash */
if ( 0 < preg_match("#\.[^/]+/$#", $string) ) {
$string = rtrim($string, '/');
}
return $string;
}
add_filter('user_trailingslashit', 'pcl_smart_trailingslashit');