Image Upload Size Restrictions (reference)

/* * Plugin Name: Image Upload Restrictions * Description: Prevents the upload of images too big, narrow, wide, tall, or short * Version: 1.2 * Author: Titus and Jeff * Author URI: https://titus-design.com */ //if (!defined(‘ABSPATH’)) die(‘Restricted Area’); add_filter(‘wp_handle_upload_prefilter’,’tps_validate_image_size’); function…Continue reading

Per User Upload Prefilter

add_filter(‘wp_handle_upload_prefilter’, ‘per_user_upload_prefilter’); function per_user_upload_prefilter($errors) { if( ( isset( $_REQUEST[‘action’] ) && ( “um_resize_image” == $_REQUEST[‘action’] || “um_imageupload” == $_REQUEST[‘action’] ) ) || isset( $_REQUEST[‘um_action’] ) ){ return $errors; } // in this filter we add a WP filter that alters…Continue reading

ACF Image Upload Size Restrictions

//add_filter(‘wp_handle_upload_prefilter’,’tps_validate_image_size’); add_filter(‘acf/validate_attachment/name=gallery_post_featured_image’, ‘tps_validate_gallery_image_size’, 10, 5); function tps_validate_gallery_image_size( $errors, $file, $attachment, $field, $context ){ $image_type = $file[‘type’]; $image_filesize = $file[‘size’]; $image_width = $file[‘width’]; $image_height = $file[‘height’]; if ( ( $image_type != ‘jpg’ ) && ( $image_type != ‘jpeg’ ) && (…Continue reading

Change srcset Sizes

function tps_change_srcset_sizes( $sizes ) { return ‘(min-width: 769px) calc( ( ( 100vw – 80px ) * .7 ) – 40px ), calc(100vw – 60px)’; } add_filter( ‘wp_calculate_image_sizes’, ‘tps_change_srcset_sizes’ );Continue reading

Disable Automatic Updates Emails

// Disable auto-update emails. add_filter( ‘auto_core_update_send_email’, ‘__return_false’ ); // Disable auto-update emails for plugins. add_filter( ‘auto_plugin_update_send_email’, ‘__return_false’ ); // Disable auto-update emails for themes. add_filter( ‘auto_theme_update_send_email’, ‘__return_false’ );Continue reading

Disable Emojis

/** * Disable the emojis in WordPress. */ add_action( ‘init’, function () { 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’,…Continue reading

Remove Header Scripts

remove_action(‘wp_head’, ‘rsd_link’); remove_action(‘wp_head’, ‘wp_generator’); remove_action(‘wp_head’, ‘feed_links’, 2); remove_action(‘wp_head’, ‘feed_links_extra’, 3); remove_action(‘wp_head’, ‘wlwmanifest_link’); remove_action(‘wp_head’, ‘adjacent_posts_rel_link’); remove_action(‘wp_head’, ‘adjacent_posts_rel_link_wp_head’, 10, 0 ); remove_action(‘wp_head’, ‘wp_shortlink_wp_head’, 10, 0); remove_action(‘wp_head’, ‘wp_oembed_add_discovery_links’, 10); remove_action(‘wp_head’, ‘rest_output_link_wp_head’, 10); remove_action(‘template_redirect’, ‘rest_output_link_header’, 11, 0); // Disable self-pingbacks function stop_self_ping( &$links )…Continue reading

Preload Featured Image

/** * Preload attachment image, defaults to post thumbnail */ function preload_post_thumbnail() { global $post; /** Prevent preloading for specific content types or post types */ if ( ! is_singular() ) { return; } /** Adjust image size based on…Continue reading