Support » Plugin: Polylang » Polylang deleted pages on deactivation

  • When deactivating polylang, all pages of default language was deleted. In pages that are left title is polylang_mo_11, url is like ?post_type=polylang_mo&p=5 and in content is serialized string.

    What might be wrong? Deleting pages on deactivation is really bad issue.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Chouby


    The only action taken by Polylang at de-activation is to reset rewrite rules. Even when deleting it (with the red link in plugins list table), Polylang removes only its own data.

    polylang_mo is a private custom post type that is used internally by Polylang and that you should never see. Especially once Polylang is de-activated, the custom post type is not registered anymore and I don’t see how it is possible to get such url (which can exist only if the custom post type is registered and is public).

    Can you check if your pages are still in DB or not?
    Can you de-activate all other plugins and come back to a default theme such as twenty twelve?

    Well, this happened on my local dev server, I’m developing theme from Underscore and using Options Framework plugin and few others. Pages are not in database, I deactivated all plugins, changed themes and still the same. Since this is in development, I re-installed WordPress and tried different combinations (deactivating plugins, change themes…) and for now is ok. What I asked earlier I want to display pages in default language in drop-down of options framework, also for categories, and I’m using two wpdb selects. I suppose with select queries it’s not possible to delete pages?! Or is it?

    Here is a query for categories:

    $options_categories = array();
        $pll_hr = 'pll_hr';
        $pll_hr_id = $wpdb->get_var($wpdb->prepare("SELECT t.term_id FROM $wpdb->terms AS t"
                        . " WHERE t.slug = %s", $pll_hr));
        $mycats = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t"
                        . " INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id"
                        . " INNER JOIN $wpdb->term_relationships AS tr ON tr.object_id = t.term_id"
                        . " WHERE tt.taxonomy IN ('category')"
                        . " AND tr.term_taxonomy_id = $pll_hr_id"
                        . " AND tt.count > 0"
                        . "", $pll_hr_id));
        foreach ($mycats as $cat) {
            $options_categories[$cat->term_id] = $cat->name;

    Here is a query for pages:

    $options_pages = array();
        //$options_pages_obj = get_pages('sort_column=post_parent,menu_order');
        $options_pages[''] = 'Odaberite stranicu:';
        $args = array(
            'post_type' => 'page',
            'orderby' => 'title',
            'order' => 'ASC',
            'lang' => 'hr'
        $pages_query = new WP_Query($args);
        while ($pages_query->have_posts()) : $pages_query->the_post();
            $options_pages[$post->ID] = $post->post_title;

    Plugin Author Chouby


    I suppose with select queries it’s not possible to delete pages?! Or is it?

    Of course you are right.

    Not relatet to your question but your query for categories looks complex. Doesn’t something like this make what you want?

    $args = array(
    	'hide_empty' => 1,
    	'lang' => 'hr'
    $mycats = get_terms('category', $args);

    Unfortunately not. Tried that and it does filter out categories by ‘hide_empty’ but not by ‘lang’. I suppose this has to do with Options Framework plugin.

    Thanks for your quick reply. I’m still working on this problem, and, honestly, for now I really don’t know what caused deleting pages, but it happened when I deactivated Polylang.

    Plugin Author Chouby


    I just remade the test and it works for me. On backend, the filter by ‘lang’ parameter is available after ‘wp_loaded’ action has been fired. On frontend, it is available after the ‘pll_language_defined’ action has been fired.

    For the ‘deleted pages’ issue, I have no clue of what could happen. The only posts that Polylang can delete are of custom post type ‘polylang_mo’ and it occurs only when deleting the plugin or when using the ‘wordpress-importer’ plugin.

    Thanks for your help, but this must be Options Framework issue since this is working only if Options Framework plugin is deactivated. I tried it on fresh WordPress install and it works the same. I will ask Options Framework developer for this.

    Thanks again.

    Here i am again and it happened again. Actually what happened this time is that one page, only one page is not deleted but some parameters are changed in database. Change is post_content, post_title and post_type. In post_content is serialized string which is showing in Settings – Languages on String Translation tab. post_title is polylang_mo_49, post_type is polylang_mo. post_name is ok and guid is ok.

    What I recently did was that I deleted some widgets and deleted some string translations on String translations tab. I’m still looking exact event that caused this issue because I’m not exactly sure when did this happened.

    For now I don’t have a clue what event changed this post.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Polylang deleted pages on deactivation’ is closed to new replies.