i want to send post slug through URL and get on other page. e.g, www.example.com/cars/mini-car how can i get 'mini-car' car type
i've found the way to get the id from url. that is;
$url = get_post_permalink(); //Get the url of the current post
$substring_start_pos = strpos($url, 'pid=') + 4; //Find the position in $url string where the url number starts
$url_number = substr($url, $substring_start_pos); //Extract the substring form the start position to the end of the url string
$key_1_values = get_post_meta($url_number, '_song_name', true );
echo "Your song is called $key_1_values";
i want to know how can i do with custom url (to get post slug of custom post type sent from previous page) like i mentioned as example