📜  wordpress 获取页面 slug - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:48.145000             🧑  作者: Mango

代码示例1
// Get the queried object and sanitize it
$current_page = sanitize_post( $GLOBALS['wp_the_query']->get_queried_object() );
// Get the page slug
$slug = $current_page->post_name;