increase postmeta dropdown limit to 30, add filter for the limit, sort the keys. props Alex King. fixes #3237
git-svn-id: http://svn.automattic.com/wordpress/trunk@4413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
fa91c7b642
commit
0c12548e12
|
@ -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>";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue