Automattic / Automattic/zoninator

get_zone_query() function not working on 5.7

Open
#48 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
86
Forks
53
PR merge metrics
No merged PRs in 30d

Description

It doesn't display posts for a zone, on the backend below is an error in the query generated by get_zone_query() method:

WordPress database error Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'wordpress.wp_postmeta.meta_value' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by for query SELECT wp_posts.\* FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND ( \n wp_postmeta.meta_key = '_zoninator_order_4942'\n) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future' OR wp_posts.post_status = 'draft' OR wp_posts.post_status = 'pending' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 ASC made by WP_Query::get_posts, referer: http://localhost/wordpress/wp-admin/admin.php?page=zoninator

Further, executed the select query directly on mysql, got the following response:

Error Code: 1055. Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'wordpress.wp_postmeta.meta_value' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Checked mysql documentation and got the following from there:

https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html

Please check the issue.

Thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.