increase postmeta dropdown limit to 30, add filter for the limit, sort the keys. props Alex King. fixes #3237

git-svn-id: https://develop.svn.wordpress.org/trunk@4413 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2006-10-22 03:18:07 +00:00
parent 3e4a8cd907
commit 0e51961694
1 changed files with 9 additions and 7 deletions

View File

@ -1024,12 +1024,14 @@ function get_meta_keys() {
function meta_form() {
global $wpdb;
$limit = (int) apply_filters('postmeta_form_limit', 30);
$keys = $wpdb->get_col("
SELECT meta_key
FROM $wpdb->postmeta
GROUP BY meta_key
ORDER BY meta_id DESC
LIMIT 10");
SELECT meta_key
FROM $wpdb->postmeta
GROUP BY meta_key
ORDER BY meta_id DESC
LIMIT $limit");
natcasesort($keys);
?>
<h3><?php _e('Add a new custom field:') ?></h3>
<table id="newmeta" cellspacing="3" cellpadding="3">
@ -1039,12 +1041,12 @@ function meta_form() {
</tr>
<tr valign="top">
<td align="right" width="18%">
<?php if ($keys) : ?>
<?php if ( $keys ) : ?>
<select id="metakeyselect" name="metakeyselect" tabindex="7">
<option value="#NONE#"><?php _e('- Select -'); ?></option>
<?php
foreach ($keys as $key) {
foreach ( $keys as $key ) {
$key = wp_specialchars($key, 1);
echo "\n\t<option value='$key'>$key</option>";
}