solution for qtranslate not support custom post

Add this function to function.php and wordpress will support qtranslate custom url with lang parameter

function qtrans_menuitem( $menu_item ) {
if ($menu_item->type == ‘custom’ && stripos($menu_item->url, get_site_url()) !== false){
$menu_item->url = qtrans_convertURL($menu_item->url);
}
return $menu_item;
}
add_filter(‘wp_setup_nav_menu_item’, ‘qtrans_menuitem’, 0);

//add (/ru) to get_permalink($custom_post)
add_filter(‘post_type_link’, ‘qtrans_convertURL’);

Leave a Comment