add_filter('auto_update_plugin', '__return_false');
Category: WordPress
Plug-ins(37)
Add custom fonts
function add_custom_fonts() { wp_enqueue_style('custom-fonts', 'https://fonts.googleapis.com/css?family=Font1|Font2'); } add_action('wp_enqueue_scripts', 'add_custom_fonts');
Add custom fields to the media library
function add_custom_media_fields($form_fields, $post) { $form_fields['custom_field'] = array( 'label' => 'Custom Field', 'input' => 'text', 'value' => get_post_meta($post->ID, '_custom_field', true), ); return $form_fields; } add_filter('attachment_fields_to_edit', 'add_custom_media_fields', 10, 2); function save_custom_media_fields($post, $attachment) { update_post_meta($post['ID'], '_custom_field', $attachment['custom_field']); return $post; } add_filter('attachment_fields_to_save', 'save_custom_media_fields', 10, 2);
Add custom code to the header
function custom_header_code() { echo ' '; } add_action('wp_head', 'custom_header_code');
Disable the WordPress REST API
function disable_rest_api() { return new WP_Error('rest_disabled', 'The REST API has been disabled.', array('status' => 403)); } add_filter('rest_authentication_errors', 'disable_rest_api');
Change the default image upload directory
function custom_upload_dir($path) { $upload_dir = wp_upload_dir(); $path['path'] = $upload_dir['basedir'] . '/custom'; $path['url'] = $upload_dir['baseurl'] . '/custom'; return $path; } add_filter('upload_dir', 'custom_upload_dir');
Remove the version of WordPress from the header
function remove_wp_version() { return ”; } add_filter('the_generator', 'remove_wp_version');
Disable the WordPress emoji script
function disable_emojis() { remove_action('wp_head', 'print_emoji_detection_script', 7); remove_action('admin_print_scripts', 'print_emoji_detection_script'); remove_action('wp_print_styles', 'print_emoji_styles'); remove_action('admin_print_styles', 'print_emoji_styles'); remove_filter('the_content_feed', 'wp_staticize_emoji'); remove_filter('comment_text_rss', 'wp_staticize_emoji'); remove_filter('wp_mail', 'wp_staticize_emoji_for_email'); } add_action('init', 'disable_emojis');
Activate free shipping for regular customers
add_filter('woocommerce_shipping_free_shipping_threshold', 'free_shipping_for_returning_customers'); function free_shipping_for_returning_customers($threshold) { if (is_user_logged_in() && current_user_can('customer_group')) { $threshold = 0; // Free shipping for regular customers } return $threshold; }
Automatically empty the shopping cart when a product is added
add_action('woocommerce_add_to_cart', 'empty_cart_on_add'); function empty_cart_on_add() { WC()->cart->empty_cart(); }