WordPress.org

Make WordPress Core

Ticket #33885: 33885.5.diff

File 33885.5.diff, 1.4 KB (added by pento, 4 years ago)
  • src/wp-admin/includes/template.php

     
    596596        $keys = apply_filters( 'postmeta_form_keys', null, $post );
    597597
    598598        if ( null === $keys ) {
     599                $keys = wp_cache_get( 'postmeta_form_keys', 'posts' );
     600        }
     601
     602        if ( ! $keys ) {
    599603                /**
    600604                 * Filters the number of custom fields to retrieve for the drop-down
    601605                 * in the Custom Fields meta box.
     
    612616                        ORDER BY meta_key
    613617                        LIMIT %d";
    614618                $keys = $wpdb->get_col( $wpdb->prepare( $sql, $wpdb->esc_like( '_' ) . '%', $limit ) );
     619
     620                wp_cache_set( 'postmeta_form_keys', $keys, 'posts' );
    615621        }
    616622
    617623        if ( $keys ) {
  • src/wp-includes/post.php

     
    17131713        if ( $the_post = wp_is_post_revision($post_id) )
    17141714                $post_id = $the_post;
    17151715
     1716        wp_cache_delete( 'postmeta_form_keys', 'posts' );
     1717
    17161718        return add_metadata('post', $post_id, $meta_key, $meta_value, $unique);
    17171719}
    17181720
     
    17361738        if ( $the_post = wp_is_post_revision($post_id) )
    17371739                $post_id = $the_post;
    17381740
     1741        wp_cache_delete( 'postmeta_form_keys', 'posts' );
     1742               
    17391743        return delete_metadata('post', $post_id, $meta_key, $meta_value);
    17401744}
    17411745