slug取得


<?php
// 自分自身のページのスラッグ取得
$slug = get_page(get_the_ID())->post_name;

// ページのスラッグ取得(子ページなら親ページのスラッグを取得)
$slug = get_page_uri($post->post_parent);

// カスタム投稿ページのスラッグ取得
$type_slug = get_page(get_the_ID())->post_type;
?>