WPML
Status
Resolved
Reported for
WPML Multilingual CMS 4.5.8
Resolved in
4.5.9

Overview of the issue

If you are using a different prefix than wp_ for your WordPress database, you may see an error indicating that the wp_terms table does not exist.

Table ‘wp.wp_terms’ doesn’t exist for query…

Workaround

Make a full backup of your site before proceeding.

  1. Open the /plugins/sitepress-multilingual-cms/classes/query-filtering/class-wpml-term-display-as-translated-adjust-count.php file.
  2. Look for line 80.
  3. For this query, change wp_ for your database prefix in lines 84, 85, 90, 91 and 93
     $prefix = $this->wpdb->prefix;
    $originalTermCount = (int) $this->wpdb->get_var(
       $this->wpdb->prepare( "
            SELECT
            (
                SELECT term_taxonomy.count
                FROM ".$prefix."term_taxonomy term_taxonomy
                INNER JOIN ".$prefix."icl_translations translations
                    ON translations.element_id = term_taxonomy.term_taxonomy_id
                WHERE translations.trid = icl_t.trid
                AND translations.language_code = %s
            ) as `originalCount`
            FROM ".$prefix."terms AS t
            INNER JOIN ".$prefix."term_taxonomy AS tt
                ON t.term_id = tt.term_id
            LEFT JOIN ".$prefix."icl_translations icl_t
                ON icl_t.element_id = tt.term_taxonomy_id
            WHERE t.term_id = %d
            ",
            $this->sitepress->get_default_language(),
            $term->term_id
        )
    );

All known issues →