[wp-trac] [WordPress Trac] #33885: meta_form performs a potentially expensive query

WordPress Trac noreply at wordpress.org
Tue Jun 6 18:37:39 UTC 2017


#33885: meta_form performs a potentially expensive query
-------------------------------------+-----------------------------
 Reporter:  jorbin                   |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Administration           |     Version:  4.3.1
 Severity:  critical                 |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  performance
-------------------------------------+-----------------------------

Comment (by johnjamesjacoby):

 > FWIW we just disable that box via filter on all sites globally now and
 have had no issues.

 This is my probably permanent ''recommended'' fix for existing
 installations, because by the time you have this much meta-data in that
 table, you will not derive very much joy from trying to choose a meta-key
 from a drop-down anyways.

 Add this to an `mu-plugin` of your choosing:

 {{{
 add_action( 'add_meta_boxes', function() {
         remove_meta_box( 'postcustom', null, 'normal' );
 } );
 }}}

 Another approach:

 {{{
 // Could use 'load-post-new.php' instead of 'admin_init'
 add_action( 'admin_init', function() {
         foreach ( get_post_types_by_support( 'post-custom' ) as $type ) {
                 remove_post_type_support( $type, 'post-custom' );
         }
 } );
 }}}

 ----

 Long running queries are long running queries. Lazy loading the box or
 drop-down options only defers the problem, and "hiding" the meta-box
 doesn't help either because the same code still executes – it's just not
 visible. The meta-box needs to be removed after it's been added.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33885#comment:51>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list