You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the post is a draft it looks like the $post-post_name is not defined so I think it might be good to take the same condition as the one in worpdress > wp-includes/link-template.php > get_post_permalink:
// Check if the post type is handle.
if (( !$draft_or_pending || $sample ) && isset($this->post_types[$post->post_type])) {
// Build URL. Lang prefix is already handle.
return home_url('/'.$this->post_types[$post->post_type]->translated_slugs[$lang]->rewrite['slug'].'/'.($leavename?"%$post->post_type%":$post->post_name));
}
This change fix the issue for me but since I don't understand why this function exist and the usage of the $leavename and $sample parameters this might as well break other things.
If this looks right and doesn't break everything I can do a pull request : )
edit: I found one issue with the proposed solution. When you try to access the draft preview as anonymous there is a redirect loop... (the url looks like mywordpress/?post_type=project&p=15426 ). Without the modification I'm redirected to the archive page.
Hey KLicheR,
First of: amazing work on adding the possibility for archive slugs! it works great!
I have a question: when using your plugin, i am not able to preview a post.
When i create a news post with slug "test-page" and i click Preview i am redirected to http://testsite.com/nieuws/test-page?preview=true and i get an 404 page. This should be http://testsite.com/nl/nieuws/test-preview?preview=true (because my default language is NL).
I tried looking for a clue but didnt find one yet. Can you help?
Thanks!
The text was updated successfully, but these errors were encountered: