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?

Read more here: Remove Trailing slash from WordPress slug


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: