Created
October 18, 2018 00:51
-
-
Save yojance/f62f7cdf193dd939b58bb70784f5bb08 to your computer and use it in GitHub Desktop.
Speed Up Large WordPress & WooCommerce Website Back-End
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'postmeta_form_limit', 'limit_postmeta_keys_to_zero', 10, 1 ); | |
function limit_postmeta_keys_to_zero( $limit ) { | |
global $post; | |
// Only for these post types | |
$valid_post_types = array( | |
// WooCommerce Subscriptions | |
'shop_subscription', | |
// WooCommerce | |
'shop_order', | |
'shop_coupon', | |
// Sensei | |
'course', | |
'lesson', | |
// WordPress | |
'page', | |
'post' | |
); | |
if( is_admin() ): | |
if( in_array( $post->post_type, $valid_post_types ) ) { | |
return 0; | |
} | |
endif; | |
return $limit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment