Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 3 replies, has 3 voices.

Last updated by Long Nguyen 1 year, 9 months ago.

Assisted by: Long Nguyen.

Author Posts
September 7, 2023 at 10:01 am #14358069

nataliaZ-2

I am trying to:
Assign custom taxonomy (category) Branże to my custom post type Case Study in proper language.

The declaration of both custom objects is as below:

function register_case_studies()
{
    $labels = array(
        'name'                => 'Case studies',
        'singular_name'       => 'Case study',
        'menu_name'           => 'Case studies',
        'all_items'           => 'Wszystkie case studies',
        'view_item'           => 'Zobacz case study',
        'add_new_item'        => 'Dodaj case study',
        'add_new'             => 'Dodaj nowe',
        'edit_item'           => 'Edytuj case study',
        'update_item'         => 'Aktualizuj',
        'search_items'        => 'Szukaj case studies',
        'not_found'           => 'Nie znaleziono',
        'not_found_in_trash'  => 'Nie znaleziono'
    );
    $args = array(
        'label' => 'case study',
        'rewrite' => array(
            'slug' => 'clients',
        ),
        'description'           => 'Case studies',
        'labels'                => $labels,
        'supports'              => array('title', 'editor'),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'show_in_nav_menus'     => true,
        'show_in_admin_bar'     => true,
        'menu_position'         => 4,
        'menu_icon'             => 'dashicons-laptop',
        'can_export'            => true,
        'has_archive'           => false,
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,
        'capability_type'       => 'post',
        'show_in_rest'          => true,
    );
    register_post_type('case-studies', $args);
}
add_action('init', 'register_case_studies', 0);


function register_custom_case_study_taxonomies()
{
    $labels = array(
        'name' => __('Branże'),
        'singular_name' => __('Branża'),
        'search_items' => __('Szukaj branż'),
        'all_items' => __('Wszystkie branże'),
        'edit_item' => __('Edytuj branżę'),
        'update_item' => __('Aktualizuj branżę'),
        'add_new_item' => __('Dodaj branżę'),
        'menu_name' => __('Branże')
    );
    $args = array(
        'public'            => false,
        'hierarchical'      => true,
        'labels'            => $labels,
        'show_ui'           => true,
        'show_admin_column' => true,
        'query_var'         => true,
        'show_in_rest'      => true,
    );
    register_taxonomy('case-study-industries', 'case-studies', $args);
}
add_action('init', 'register_custom_case_study_taxonomies', 0);

The settings for these objects in WPML > Settings are visible on the attached images.

Link to a page where the issue can be seen:
The issue is visible only in our WordPress dashboard.

I expected to see:
List of Branże for a single Case study in WordPress editor in proper language. On the website currently are two languages: English (default) and Polish. Ability of translation is switched on for Case Study CPTs and Branże taxonomy (category).

Instead, I got:
The list of Branże in WordPress editor is loading randomly, sometimes during edition of English translation of a Case Study the list of Branżes is load with Polish translations, sometimes the list of Branże is loaded with English Branżes while editing Polish version of a Case Study. After a few reloading of the WordPress editor webpage usually Branżes are appear loaded properly, but this is really inconvinient .

wpml_case-studies.jpg
wpml_brnaze.jpg
September 8, 2023 at 12:10 pm #14366479

Alejandro
WPML Supporter since 02/2018

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello!

It's likely that the reason why it appears randomly happens because of the priority set:

add_action('init', 'register_custom_case_study_taxonomies', 0);

the default priority is 10, so you can remove that parameter:

add_action('init', 'register_custom_case_study_taxonomies');

that might help here. that's usually the default priority for this type of code so it should work out of the box with us.

Try it out and let us know if it works.

September 12, 2023 at 9:47 am #14382301

nataliaZ-2

Hello Alejandro,

thank you for your support. Unfortunatelly, changing priorities did not helped me. In wordpress editor the section with taxonomy Braże the "widget"/section when I can choose/assign Branżes to a Case Study is loaded few second after the whole wordpress editor is loaded. I assume, that is made by some kind of AJAX in the background, maybe this information will be crucial in this case.

While testing, I was opening in new tabs three random CaseStudies in Polish and English versions and the language of loaded Branżes list was in 50% loaded in wrong langue.

September 13, 2023 at 4:05 am #14386909

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Natalia,

Thank you for contacting WPML support, I'd be happy to help you with this issue.

I've tried to replicate the issue on my local site but did not see that. The list of Branże terms is displayed in the current language correctly. Please check this screenshot hidden link

I suggest you can try some troubleshooting steps below and see if they help:

1. Enable a minimal environment:
- Disable all non-WPML plugins.
- Switch to a standard theme of WordPress.

2. Increase WP memory limit: The minimum requirements are 128M, but we do recommend 256M and the debug information of your site shows it set to 40M. Please check this link for more details https://wpml.org/home/minimum-requirements/.
You can increase it by adding the following code in your wp-config.php file, right before the /* That’s all, stop editing! Happy publishing. */ line:

define( 'WP_MAX_MEMORY_LIMIT', '256M' );
define( 'WP_MEMORY_LIMIT', '128M' );

After adding the code you can confirm that the memory was changed correctly from WPML > Support > WordPress > Memory limit.

3. Update WPML plugins to the new version WPML 4.6.6, String Translation 3.2.8.

Or you can try to replicate this on a clean installation of WordPress. With the link below, you can login directly to the admin area of a sandbox site.
hidden link

Look forward to your reply.
Thanks

The topic ‘[Closed] Custom categories displays in editor in wrong language’ is closed to new replies.