Ticket #18979: meta_form.diff
File meta_form.diff, 1.7 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/meta-boxes.php
430 430 unset( $metadata[ $key ] ); 431 431 } 432 432 list_meta( $metadata ); 433 meta_form( ); ?>433 meta_form( $post->post_type ); ?> 434 434 </div> 435 435 <p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p> 436 436 <?php -
wp-admin/includes/template.php
491 491 * 492 492 * @since 1.2.0 493 493 */ 494 function meta_form( ) {494 function meta_form( $post_type = '' ) { 495 495 global $wpdb; 496 496 497 $limit = (int) apply_filters( 'postmeta_form_limit', 30 ); 497 $keys = $wpdb->get_col( " 498 SELECT meta_key 499 FROM $wpdb->postmeta 500 GROUP BY meta_key 501 HAVING meta_key NOT LIKE '\_%' 502 ORDER BY meta_key 503 LIMIT $limit" ); 498 499 $q = "SELECT meta_key FROM $wpdb->postmeta"; 500 501 if ( ! empty( $post_type ) && post_type_exists( $post_type ) ) 502 $q .= $wpdb->prepare( " INNER JOIN $wpdb->posts ON post_id = ID WHERE post_type LIKE %s", $post_type ); 503 504 $q .= " GROUP BY meta_key HAVING meta_key NOT LIKE '\_%' ORDER BY meta_key LIMIT $limit"; 505 506 $keys = $wpdb->get_col( $q ); 507 508 $keys = apply_filters( 'postmeta_form_keys', $keys, $post_type ); 509 504 510 if ( $keys ) 505 natcasesort( $keys);511 natcasesort( $keys ); 506 512 ?> 507 513 <p><strong><?php _e( 'Add New Custom Field:' ) ?></strong></p> 508 514 <table id="newmeta">