今天ytkah在看客戶的網站時發現頭部提示Warning:Parameter 2 to qtranxf_postsFilter() expected to be a reference, value given in ...,出現這個原因是翻譯插件定義有問題,那我們一起來看看如何修改吧
打開文件qtranslate-x/qtranslate_frontend.php,找到大概523行左右
function qtranxf_postsFilter($posts,&$query) {//WP_Query
改成
function qtranxf_postsFilter($posts,$query) {//WP_Query
還有另外一處修改,大概597行左右
function qtranxf_excludeUntranslatedPosts($where,&$query) {//WP_Query
改成
function qtranxf_excludeUntranslatedPosts($where,$query) {//WP_Query
保存,刷新緩存,錯誤提示消失了
參考資料https://wordpress.org/support/topic/problem-with-php-7-1-2/#post-8908632