Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#44874 closed defect (bug) (invalid)

get_permalink($id) returns different output when on ajax mode.

Reported by: gpisw's profile gpisw Owned by:
Milestone: Priority: normal
Severity: critical Version: 4.9.8
Component: Permalinks Keywords:
Focuses: Cc:


  • WordPress version: 4.9.8
  • Theme: twentyseventeen
  • Active plugins: WPML Multilingual CMS and custom plugin in development
  • Observations: For this issue it's needed WPML Multilingual CMS. I found this issue, while developing a custom plugin.
  • Setup: Clean install. WPML installed. Hello World post translated to Catalan (any language is valid).
  • Problem: When calling get_permalink($id) from an ajax request, using the original post id and the translated post id (1, and 7), it returns the same url, depending on current language.

  • Expected: Expected to work like in the frontend or admin pages.

Output for a custom admin page:

  id: 10 - permalink: http://localhost:8000/es/hola-mundo/
  id: 7 - permalink: http://localhost:8000/ca/hola-mon/
  id: 1 - permalink: http://localhost:8000/hello-world/

Output for ajax call with language set to english:

  id: 10 - permalink: http://localhost:8000/hello-world/
  id: 7 - permalink: http://localhost:8000/hello-world/
  id: 1 - permalink: http://localhost:8000/hello-world/

Attachments (3)

photo_2018-08-31_12-40-28.jpg (8.9 KB) - added by gpisw 6 years ago.
output returned from ajax call
photo_2018-08-31_12-40-34.jpg (6.6 KB) - added by gpisw 6 years ago.
print from admin page
photo_2018-08-31_12-45-33.jpg (6.5 KB) - added by gpisw 6 years ago.
return from ajax call

Download all attachments as: .zip

Change History (4)

6 years ago

output returned from ajax call

6 years ago

print from admin page

6 years ago

return from ajax call

#1 @johnbillion
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Thanks for your report, @gpisw.

This isn't the place to report issues that are caused or affected by plugins and themes, but for issues in the core WordPress software. Your best bet is to report this on the WPML support forums (WPML is not related to the WordPress project), and if it's determined that the bug is indeed an issue in WordPress core then feel free to reopen this ticket with some more details.

Note: See TracTickets for help on using tickets.