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