Posted on

wordpress error on qtranslate switching from php 5 to php 7

Switching from php 5 to php 7, you will get this error on the qtranslate X plugin

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /public_html/wp-content/plugins/qtranslate-x/qtranslate_frontend.php on line 497

Warning: Parameter 2 to qtranxf_postsFilter() expected to be a reference, value given in /public_html/wp-includes/class-wp-hook.php on line 286

Solution

Using ftp open the file qtranslate-x/qtranslate_frontend.php. you need to make 3 substitutions :

  • In line 497 change
continue;

to

break;
  • In line 523 change
function qtranxf_postsFilter($posts,&$query) {//WP_Query

to

function qtranxf_postsFilter($posts,$query) {//WP_Query
  • in line 597 change
function qtranxf_excludeUntranslatedPosts($where,&$query) {//WP_Query

to

function qtranxf_excludeUntranslatedPosts($where,$query) {//WP_Query