Changeset 10437 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
- Timestamp:
- 11/10/2020 04:24:59 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
r10214 r10437 49 49 add_action( 'add_meta_boxes', array( $this, 'register_admin_metaboxes' ), 10, 2 ); 50 50 add_action( 'do_meta_boxes', array( $this, 'replace_title_global' ) ); 51 52 add_filter( 'postmeta_form_keys', array( $this, 'postmeta_form_keys' ) ); 51 53 52 54 add_filter( 'postbox_classes_plugin_internal-notes', array( __NAMESPACE__ . '\Metabox\Internal_Notes', 'postbox_classes' ) ); … … 658 660 $x->send(); 659 661 } 662 663 /** 664 * Cache / Filter the keys to display in the dropdown list for custom post meta. 665 */ 666 function postmeta_form_keys( $keys ) { 667 global $wpdb; 668 if ( ! is_null( $keys ) ) { 669 return $keys; 670 } 671 672 // We're going to cache this for 24hrs.. that might be enough. 673 $keys = wp_cache_get( __METHOD__, 'distinct-meta-keys' ); 674 675 if ( ! $keys ) { 676 // Exclude the translated meta fields. 677 $keys = $wpdb->get_col( 678 "SELECT DISTINCT meta_key 679 FROM $wpdb->postmeta 680 WHERE meta_key NOT BETWEEN '_' AND '_z' 681 HAVING 682 meta_key NOT LIKE '\_%' AND 683 meta_key NOT LIKE 'title\_%' AND 684 meta_key NOT LIKE 'block_title\_%' AND 685 meta_key NOT LIKE 'excerpt\_%' AND 686 meta_key NOT LIKE 'content\_%' 687 ORDER BY meta_key 688 LIMIT 300", 689 ); 690 } 691 692 wp_cache_set( __METHOD__, $keys, 'distinct-meta-keys', DAY_IN_SECONDS ); 693 694 return $keys; 695 } 660 696 }
Note: See TracChangeset
for help on using the changeset viewer.