I want to retrieve the slug of the current page in Wordpress. This works:
<?php global $post; $post_slug=$post->post_name;?>
But it contains a trailing slash. I want to trim the traling slash, how can I do that? Thanks?
I want to retrieve the slug of the current page in Wordpress. This works:
<?php global $post; $post_slug=$post->post_name;?>
But it contains a trailing slash. I want to trim the traling slash, how can I do that? Thanks?
$post_slug = rtrim($post->post_name,"/");