Disable Thumbnail Image Sizes

add_filter( ‘intermediate_image_sizes_advanced’, function( $sizes ) { // Disable specific thumbnail sizes, uncomment the ones you want to disable. // unset( $sizes[‘thumbnail’] ); // 150px x 150px // unset( $sizes[‘medium’] ); // 300px x 300px // unset( $sizes[‘medium_large’] ); // 768px…Continue reading

Add Auto Sizes to Lazy Loaded images

add_filter( ‘wp_get_attachment_image_attributes’, function( $attr ) { if ( ! isset( $attr[‘loading’] ) || ‘lazy’ !== $attr[‘loading’] || ! isset( $attr[‘sizes’] ) ) { return $attr; } // Skip if attribute was already added. if ( false !== strpos( $attr[‘sizes’], ‘auto,’…Continue reading

Disable WordPress 6.5 Font Library

add_filter( ‘block_editor_settings_all’, function( $editor_settings ) { $editor_settings[‘fontLibraryEnabled’] = false; return $editor_settings; } ); // Disable the REST API for the font library. add_filter( ‘register_post_type_args’, function( $arg, $post_type ) { if ( ‘wp_font_family’ === $post_type || ‘wp_font_face’ === $post_type ) {…Continue reading

News title Character Limit

function truncate_html($html, $maxLength) { // Return early if the initial string is shorter than the maxLength if (strlen($html) loadHTML(mb_convert_encoding($html, ‘HTML-ENTITIES’, ‘UTF-8’), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); libxml_clear_errors(); // Use an XPath query to select all text nodes $xpath = new DOMXPath($dom); $textNodes…Continue reading

Loading custom templates

/** * Plugin Name: WPForms Custom Templates * Description: This plugin loads custom form templates. * Version: 1.0.0 */ /** * Load the templates. */ function wpf_load_custom_templates() { // Template code here } add_action( ‘wpforms_loaded’, ‘wpf_load_custom_templates’ );Continue reading

WP Mail SMTP access rights to other users

add_filter(‘wp_mail_smtp_admin_area_get_logs_access_capability’, function (){ return ‘manage_options’; }); add_filter(‘wp_mail_smtp_pro_emails_logs_logs_get_manage_capability’, function (){ return ‘manage_options’; });Continue reading

EDD Smart Tags

add_filter( ‘wpcode_smart_tags’, function ( $tags ) { $tags[‘edd’] = array( ‘label’ => ‘Easy Digital Downloads’, ‘tags’ => array( ‘edd_order_total’ => array( ‘label’ => ‘Order Total’, ‘function’ => ‘wpcode_custom_get_edd_order_total’, ), ‘edd_order_items_count’ => array( ‘label’ => ‘Order Items Count’, ‘function’ => ‘wpcode_custom_get_edd_order_items_count’,…Continue reading