• Hi.

    First I had translations enabled for my custom post type.
    Then I disabled it. Now the archive template for the custom post type doesn’t work anymore.

    The output of wp_query shows that Polylang tries to find translations even though they don’t exist anymore (I actually removed all postmeta _translations from the database that was connected to the custom post type). I really can’t find a solution on this and I’m considering deleting the plugin and then reinstall it. But I have a lot of pages and posts that I would manually have to set to two languages after reactivating Polylang, and it would be a lot of work.

    Any solutions how to sweep out or control the query for an archive with posts in no language?

    Basically what I want Polylang to do is keeping the language chosen by the visitor and not control the output of these custom post types. Should be possible?

    http://wordpress.org/extend/plugins/polylang/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter swedish boy

    (@swedish-boy)

    I managed to solve my problem by hacking into pre_get_posts and unset the lang var in query_vars:

    function fix_our_query($query) {
    	if(! is_admin() && $query->is_main_query()) {
    		if(is_archive()) {
    
    			if($query->query_vars['post_type']=='konstnarer')
    				unset($query->query_vars['lang']);
    
    		}
    
    	}
    }
    add_action( 'pre_get_posts', 'fix_our_query', 999 );

    For some reason I couldn’t use is_post_type_archive('my-custom-post-type') but had to use is_archive() and then detect if I was on the right archive page.

    Thread Starter swedish boy

    (@swedish-boy)

    But there still errors. For example the page is titled (<title>-tag) from the language.

    Plugin Author Chouby

    (@chouby)

    I reproduced the bug. I just uploaded a development version (1.1.2.1) which should have corrected it.
    http://downloads.wordpress.org/plugin/polylang.zip

    Thread Starter swedish boy

    (@swedish-boy)

    Thanks for the feedback!

    Will look into it.
    Great plugin otherwise! Keep up the good work!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘archive won't work after disabling translations for custom post type’ is closed to new replies.