get current page name in wordpress in theme functions file code example
Example: get page name wp
$slug = basename(get_permalink());
//or
$wp_query->queried_object->post_name
$slug = basename(get_permalink());
//or
$wp_query->queried_object->post_name