Polylang does not translate custom pot type labels on frontend
-
I have a problem. Polylang does not translate custom post type labels.
I register a new post type in my theme function.php and translate the labels using the function pll__.add_action( 'init', 'register_post_type' ); $labels = array( 'name' => pll__( 'Territories' ), 'singular_name' => pll__( 'Territory' ), 'add_new' => pll__( 'Add New' ), 'add_new_item' => pll__( 'Add New Territory' ), 'edit_item' => pll__( 'Edit Territory' ), 'new_item' => pll__( 'New Territory' ), 'view_item' => pll__( 'View Territory' ), 'search_items' => pll__( 'Search Territories' ), 'not_found' => pll__( 'No Territories yet' ), 'not_found_in_trash' => pll__( 'No Territories in trash' ), 'parent_item_colon' => '', 'menu_name' => pll__( 'Territories' ), ); register_post_type( 'wm_territory', array( 'labels' => $labels, 'description' => pll__( 'Territories for creating territories page' ), 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'territories', ), 'capability_type' => array( 'territory', 'territories' ), 'map_meta_cap' => true, 'has_archive' => true, 'hierarchical' => false, 'menu_position' => 25, 'menu_icon' => 'dashicons-location-alt', 'supports' => array( 'title', 'editor', 'author', 'thumbnail' ), ) );
On page /wp-admin/edit.php?post_type=wm_territory Polylang translates correctly. There is used
$post_type_object = get_post_type_object( $post_type );
code. When I use the same code in my archive-wm_territory.php, Polylang does not translate labels.What should I do to make Polylang translate it?
- The topic ‘Polylang does not translate custom pot type labels on frontend’ is closed to new replies.