I use

'rewrite' => array('slug' => 'uniquename')

for custom post type, and I will have site in two languages. I tried to use

if( is_main_site() ) { $slug = 'uniquename' } else { $slug = 'uniquenametwo' }

and then enter it in rewrite value, but that didn't seem to work. What other options do I have?

  • PS I use is_main_site to translate templates in my website with using multisite – Arttyor Jan 3 at 22:58

so I added

if( is_main_site()) { $slug = 'uniquename'; } else {  $slug = 'uniquenametwo'; }


'rewrite' => array('slug' => $slug ),

inside register_post_type function and it worked. before i tried outside it. Im new to this. Anyway this worked in my case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.