how to get the slug from the page url in wordpress code example Example: get current page slug $slug = get_queried_object()->post_name;