From f9ec35ddab072e3e277d4eef543d18dc225758be Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 23 Jul 2015 05:16:04 +0000 Subject: [PATCH] Switch to a more performant query in meta_form(). Props lumaraf, swissspidy, rarylson, pento Fixes #24498 git-svn-id: https://develop.svn.wordpress.org/trunk@33390 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/template.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php index 88c7155e95..6a457c54f9 100644 --- a/src/wp-admin/includes/template.php +++ b/src/wp-admin/includes/template.php @@ -677,9 +677,9 @@ function meta_form( $post = null ) { * @param int $limit Number of custom fields to retrieve. Default 30. */ $limit = apply_filters( 'postmeta_form_limit', 30 ); - $sql = "SELECT meta_key + $sql = "SELECT DISTINCT meta_key FROM $wpdb->postmeta - GROUP BY meta_key + WHERE meta_key NOT BETWEEN '_' AND '_z' HAVING meta_key NOT LIKE %s ORDER BY meta_key LIMIT %d";