get slug from url code example
Example 1: get current page slug
$slug = get_queried_object()->post_name;
Example 2: slug url
A slug is the part of a URL which identifies a particular page on a
website in an easy to read form.
$slug = get_queried_object()->post_name;
A slug is the part of a URL which identifies a particular page on a
website in an easy to read form.