Avoid expensive NOT LIKE query. Filter in php instead.

git-svn-id: https://develop.svn.wordpress.org/trunk@11132 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-04-29 23:32:53 +00:00
parent 172855f545
commit bbd5c9e581
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">