-1

Hi i am working on a wordpress website and i am little stuck into one situation,

https://jobicons.com/newsite/my-profile/

the above is the url of my web site i only want to store the my-profile parameter in the $variable , is there any way how can i do this? Thanks in advance.

1 Answers1

0

using php it is as simple as doing this:

<?php echo basename($URL);

but since you're using wordpress, this is how you should be able to get the slug name for a post

<?php 
   global $post;
   $post_slug = $post->post_name;
?>
Sumit Wadhwa
  • 2,825
  • 1
  • 20
  • 34