• I wrote a plugin for a custom taxonomy, but for some reason the translations doesn’t apply everywhere it should. The taxonomy is called ‘Organiser’ (it’s for events with Event Manager plugin).

    One the taxonomy archive page in front end, and the backend for editing taxonomy terms (/wp-admin/edit-tags.php?taxonomy=organiser&post_type=event), the term Organiser is not translated. Everything else is translated, so I don’t know why this doesn’t apply.

    Here’s the code:

    function wporg_register_taxonomy_em_arrangorer() {
    	 $labels = array(
    		 'name'              => _x( 'Organisers', 'taxonomy general name', 'event-arrangorer' ),
    		 'singular_name'     => _x( 'Organiser', 'taxonomy singular name', 'event-arrangorer' ),
    		 'search_items'      => __( 'Search Organisers', 'event-arrangorer' ),
    		 'all_items'         => __( 'All Organisers', 'event-arrangorer' ),
    		 'parent_item'       => __( 'Parent Organiser', 'event-arrangorer' ),
    		 'parent_item_colon' => __( 'Parent Organiser:', 'event-arrangorer' ),
    		 'edit_item'         => __( 'Edit Organiser', 'event-arrangorer' ),
    		 'update_item'       => __( 'Update Organiser', 'event-arrangorer' ),
    		 'add_new_item'      => __( 'Add New Organiser', 'event-arrangorer' ),
    		 'new_item_name'     => __( 'New Organiser Name', 'event-arrangorer' ),
    		 'menu_name'         => __( 'Organisers', 'event-arrangorer' ),
    	 );
    	 $args   = array(
    		 'hierarchical'      => true, // make it hierarchical (like categories)
    		 'labels'            => $labels,
    		 'show_ui'           => true,
    		 'show_in_rest'		 => true,
    		 'show_admin_column' => true,
    		 'show_in_menu'		 => true,
    		 'query_var'         => true,
    		 'rewrite'           => [ 'slug' => 'organiser' ],
    	 );
    	 register_taxonomy( 'organiser', [ 'event' ], $args );
    }
    add_action( 'init', 'wporg_register_taxonomy_em_arrangorer' );
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Check your plugin’s applicable .po language file. It’s possible the name was never translated by a translator.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom taxonomy doesn’t translate properly’ is closed to new replies.