Reputation: 57176
I have set all my site urls to the custom structure in Permalink Settings:
/portfolio/%postname%/
But when I try to get a post clean URL in my admin area at 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);
Result:
http://mywebsite.com/?p=415
But it should be:
http://mywebsite.com/portfolio/sample-1/
Why? What have I missed?
Upvotes: 0
Views: 1601
Reputation: 57176
The cause of it is that the page has no slug data. Only the slug data is stored then I can get the clean URL.
Upvotes: 2