Changeset 4413

Show
Ignore:
Timestamp:
10/22/06 03:18:07 (2 years ago)
Author:
markjaquith
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/admin-functions.php

    r4408 r4413  
    10251025function meta_form() { 
    10261026    global $wpdb; 
     1027    $limit = (int) apply_filters('postmeta_form_limit', 30); 
    10271028    $keys = $wpdb->get_col(" 
    1028             SELECT meta_key 
    1029             FROM $wpdb->postmeta 
    1030             GROUP BY meta_key 
    1031             ORDER BY meta_id DESC 
    1032             LIMIT 10"); 
     1029        SELECT meta_key 
     1030        FROM $wpdb->postmeta 
     1031        GROUP BY meta_key 
     1032        ORDER BY meta_id DESC 
     1033        LIMIT $limit"); 
     1034    natcasesort($keys); 
    10331035?> 
    10341036<h3><?php _e('Add a new custom field:') ?></h3> 
     
    10401042    <tr valign="top"> 
    10411043        <td align="right" width="18%"> 
    1042 <?php if ($keys) : ?> 
     1044<?php if ( $keys ) : ?> 
    10431045<select id="metakeyselect" name="metakeyselect" tabindex="7"> 
    10441046<option value="#NONE#"><?php _e('- Select -'); ?></option> 
    10451047<?php 
    10461048 
    1047     foreach ($keys as $key) { 
     1049    foreach ( $keys as $key ) { 
    10481050        $key = wp_specialchars($key, 1); 
    10491051        echo "\n\t<option value='$key'>$key</option>";