Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#29630 closed enhancement (invalid)

Translatable slug in register_post_type and register_taxonomy

Reported by: gugaalves's profile gugaalves Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description (last modified by ocean90)

When registering a Custom Post Type or a Custom Taxonomy, we're able to pass translations to labels, but can't do it in slugs.

Why we can't do this:

'rewrite' => array( 
     'slug' => _x('Books', 'post type general name', 'your-plugin-textdomain' )
),

In sites like WordCamp sites, for example, its weird to a Brazilian Sponsor see /sponsor instead of /patrocinador in post slug.

Change History (4)

#1 follow-up: @ocean90
10 years ago

  • Description modified (diff)
  • Keywords reporter-feedback added

Hello gugaalves,

this is already possible, what doesn't work for you in detail?

Last edited 10 years ago by ocean90 (previous) (diff)

#2 @nacin
10 years ago

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

This works. You just have to make sure you're calling register_post_type() after translations are loaded. Since in this case you need to call it after WP_Rewrite is initialized, then you should be good.

For WordCamp sites, you can submit a ticket to https://meta.trac.wordpress.org/ if you'd like it supported there.

#3 in reply to: ↑ 1 @gugaalves
10 years ago

Replying to ocean90:

Hello gugaalves,

this is already possible, what does't work for you in detail?

I'll test again then, some may have been my mistake or my local environment.

That should already be in use on WordCamps themes then, I thought this test after seeing that it didn't happen in the WordCamp Rio de Janeiro site, i'll register this in the other trac, thanks :)

Last edited 10 years ago by gugaalves (previous) (diff)

#4 @SergeyBiryukov
10 years ago

  • Keywords reporter-feedback removed
  • Summary changed from Translatable slug in registe_post_type and register_taxonomy to Translatable slug in register_post_type and register_taxonomy
Note: See TracTickets for help on using tickets.