Opened 5 years ago
Closed 10 months ago
#54964 closed defect (bug) (worksforme)
get_permalink() does not use the correct slug rewrite base
| Reported by: | jakubaondrej | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Posts, Post Types | Version: | |
| Severity: | normal | Keywords: | needs-patch reporter-feedback |
| Cc: | Focuses: | rest-api |
Description
Hello,
get_permalink does not work well for custom posts with slug rewrite.
E.g. I have implemented articles post type:
<?php register_post_type('articles', array(... 'rewrite' => array('slug' => _x('articles','slug','mydomain')),...));
'articles' is translateD to slovak language as 'clanky'. But get_permalink({id_of_article}) returns localhost:10010/articles/my-title. It is wrong and i have recieve error 404, because right link is localhost:10010/clanky/my-title.
It works OK for older WP version.
Thanks a lot for any result.
Kind regards,
Ondrej Jakuba
Change History (7)
This ticket was mentioned in Slack in #accessibility by ryokuhi. View the logs.
5 years ago
This ticket was mentioned in Slack in #core-test by hellofromtonya. View the logs.
5 years ago
#4
@
4 years ago
- Component I18N → Posts, Post Types
- Focuses coding-standards removed
- Summary get_permalink → get_permalink() does not use the correct slug rewrite base
This ticket was mentioned in Slack in #core by sirlouen. View the logs.
10 months ago
#7
@
10 months ago
- Milestone Awaiting Review
- Resolution → worksforme
- Severity blocker → normal
- Status new → closed
- Version 5.9
Since no one has been able to reproduce this and more than 2 years have passed since then, it's time to close this as worksforme
@jakubaondrej feel free to comment if you can provide additional information on how to reproduce this, and I will be happy to reopen and test it accordingly.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I looked into this issue during the Yoast Contributor Day, I could not reproduce the problem in 6.4 beta 2.
This is how I tried:
Bookpost type, it got id 6wp-content/plugins/yoast-test-helper/src/post-types.phpto change fromyoast-test-bookstolibriecho get_permalink( 6 );(notice that the link would return a 404 unless the permalink had been flushed, but it's not needed to get the translated URL).
@jakubaondrej can you check again if the issue is still occurring, and if so, can you provide instructions to reproduce?