WordPress.org

Make WordPress Core

#43991 closed defect (bug) (duplicate)

Flush rewrites depend on admin language, not site language

Reported by: danielpataki Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:
PR Number:

Description

Hi everyone,

I've found an issue which seems to prevent proper translations of custom post type rewrite slugs. The issue is that when the rewrite rules are regenerated the user's admin language setting is taken into account.

You can reproduce the issue in a vanilla WP install using twentyseventeen with the following modifications. I have also attached a zip version of the modified theme for brevity's sake.

I registered a custom post type with the following rewrite parameter

'rewrite' => array( 'slug' => __('careers', 'textdomain'), 'with_front' => false ),

I changed the language of the site to Spanish and made sure the po file was in place. "careers" was translated to "carreras". I generated the mo file, visited the permalink settings page. I could then go to the /carreras/ page and it loaded as expected.

Now, if you go and change your admin language only in your profile settings and then go to the permalink page it breaks. The archive is accessible through /careers/ as usual.

I am not familiar enough with the rewrite subsystem to propose changes, but hopefully someone here has the experience to do so :)

Thanks so much!

Attachments (1)

twentyseventeen-mod.zip (937.0 KB) - added by danielpataki 19 months ago.
Modified twentyseventeen theme to show the behaviour explained in the ticket

Download all attachments as: .zip

Change History (2)

@danielpataki
19 months ago

Modified twentyseventeen theme to show the behaviour explained in the ticket

#1 @ocean90
19 months ago

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

Hello @danielpataki, thanks for your report. We're already tracking this issue in #39587.

Note: See TracTickets for help on using tickets.