Skip Navigation

Open

Reported for: WPML Multilingual CMS 4.6.7

Topic Tags: Bug, Performance

Overview of the issue

If you are using WPML String Translation on a WordPress site with a significant number of users, you may experience a substantial delay when accessing the WPML > String Translation page. This issue stems from a specific query that becomes increasingly slow as the number of users grows.

Workaround

Please, make sure of having a full backup of your site before proceeding.

  • Open …/wp-content/plugins/sitepress-multilingual-cms/classes/user/class-wpml-translation-roles-records.php file.
  • Look for line 127.
  • Change:
    		$preparedUserQuery = $this->wpdb->prepare(
    			"SELECT u.id FROM {$this->wpdb->users} u INNER JOIN {$this->wpdb->usermeta} c ON c.user_id=u.ID AND CAST(c.meta_key AS BINARY)=%s AND c.meta_value {$compare} %s",
    			"{$this->wpdb->prefix}capabilities",
    			"%" . $this->get_capability() . "%"
    		);
    
  • For:
    		$preparedUserQuery = $this->wpdb->prepare(
    			"SELECT u.id FROM {$this->wpdb->users} u INNER JOIN {$this->wpdb->usermeta} c ON c.user_id=u.ID AND c.meta_key=%s AND c.meta_value {$compare} %s",
    			"{$this->wpdb->prefix}capabilities",
    			"%" . $this->get_capability() . "%"
    		);
    

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>