//获取当前页面的id $page_id = $wp_query->get_queried_object_id(); //获取当前页面的别名 $slug = get_page( $page_id ); echo $slug->post_name;