wordpress get page by slug return old page code example Example: get current page slug $slug = get_queried_object()->post_name;