Avoid expensive NOT LIKE query. Filter in php instead.

git-svn-id: http://svn.automattic.com/wordpress/trunk@11132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-04-29 23:32:53 +00:00
parent c5c7eff703
commit f78640043d
1 changed files with 6 additions and 2 deletions

View File

@ -2449,12 +2449,16 @@ function meta_form() {
$keys = $wpdb->get_col( "
SELECT meta_key
FROM $wpdb->postmeta
WHERE meta_key NOT LIKE '\_%'
GROUP BY meta_key
ORDER BY meta_key
LIMIT $limit" );
if ( $keys )
if ( $keys ) {
function filter_private_keys($key) {
return ( 0 === strpos($key, '_') ) ? false : true;
}
$keys = array_filter($keys, 'filter_private_keys');
natcasesort($keys);
}
?>
<p><strong><?php _e( 'Add new custom field:' ) ?></strong></p>
<table id="newmeta">