Disable qTranslate by post type in admin + disable per page / post ID on front-end [closed]
IT Nursery
May 8, 2022
0
I’m trying to find a way to selectively disable qTranslate – I would like to be able to show certain static content on my site in 4 languages, but to then only have a single language (and a simplified editor) for posts and also custom post types.
I would also need to disable the output on selective pages in the front-end, so that I can show all the language content on the same page, at the same time.
Is there a way to have the plugin load on demand?
2 Answers 2
Following snippet will disable it for post_type post (modify array below to affect other post_types):
function qtrans_disable()
{
global $typenow, $pagenow;
if (in_array($typenow, array('post')) && // post_types where qTranslate should be disabled
in_array($pagenow, array('post-new.php', 'post.php')))
{
remove_action('admin_head', 'qtrans_adminHeader');
remove_filter('admin_footer', 'qtrans_modifyExcerpt');
remove_filter('the_editor', 'qtrans_modifyRichEditor');
}
}
add_action('current_screen', 'qtrans_disable');
Similarly you can disable it for specific post IDs. However take into account that this won’t affect already existing multi-languaged content. Therefore use it before you enter any.