我已将所有网站 url 设置为永久链接设置中的自定义结构:
/portfolio/%postname%/
但是当我尝试在我的管理区域中获取一个干净的 URL时http://mywebsite.com/wp-admin/post.php?post=415&action=edit
:
// Get post/page ID.
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
get_permalink($post->ID);
结果:
http://mywebsite.com/?p=415
但它应该是:
http://mywebsite.com/portfolio/sample-1/
为什么?我错过了什么?