Image Type Convert

// Image Type Convert / Kiri Vadivelu / 2026 add_filter( ‘wp_handle_upload’, ‘image_type_convert’ ); function image_type_convert( $upload ) { // Only process images if ( ! isset( $upload[‘type’] ) || ! in_array( $upload[‘type’], [ ‘image/jpeg’, ‘image/png’, ‘image/jpg’ ], true ) )…Continue reading

Image Quality Scale

// Image Quality Scale / Kiri Vadivelu / 2026 function image_quality_scale( $quality, $mime_type ) { if ( ‘image/webp’ === $mime_type ) { return 70; // Webp default 86 } return $quality; } add_filter( ‘wp_editor_set_quality’, ‘image_quality_scale’, 10, 2 );Continue reading

SVG upload for WP Admin only

/** * Enable SVG uploads for Administrators only */ function enable_svg_uploads_for_admins($mime_types) { if (current_user_can(‘manage_options’)) { $mime_types[‘svg’] = ‘image/svg+xml’; $mime_types[‘svgz’] = ‘image/svg+xml’; } return $mime_types; } add_filter(‘upload_mimes’, ‘enable_svg_uploads_for_admins’); /** * Bypass secondary file-type check for SVG uploads by admins */ function…Continue reading

Remove Admin Help

// Remove Admin Help / Kiri Vadivelu / 2026 add_action( ‘admin_head’, ‘remove_admin_help_tabs’ ); function remove_admin_help_tabs() { $screen = get_current_screen(); if ( $screen ) { $screen->remove_help_tabs(); } }Continue reading

Custom Screen Option

// Custom Screen Option / Kiri Vadivelu / 2026 function custom_screen_option() { if ( get_current_user_id() !== 1 ) { // Replace your ID return false; } return true; } add_filter( ‘screen_options_show_screen’, ‘custom_screen_option’ );Continue reading

Remove Dashboard Widget

// Remove Dashboard Widget / Kiri Vadivelu / 2026 add_action( ‘wp_dashboard_setup’, ‘remove_dashboard_widget’ ); function remove_dashboard_widget() { // Remove specific widgets by their ID and section remove_meta_box( ‘dashboard_right_now’, ‘dashboard’, ‘normal’ ); // At a Glance remove_meta_box( ‘dashboard_activity’, ‘dashboard’, ‘normal’ ); //…Continue reading

Contributor Default Role

// Contributor Default Role / Kiri Vadivelu / 2026 function contributor_default_role( $default_role ) { return ‘contributor’; // Replace your choice } add_filter( ‘pre_option_default_role’, ‘contributor_default_role’ );Continue reading

lokalstolz | Bildmaße ergänzen

/* * WPCode-Snippet “lokalstolz | Bildmasse ergaenzen” (Typ php, Location everywhere, Auto-Insert an, Prioritaet 10) * Oxygen 6 gibt an Bildern kein width und height aus. Lighthouse meldet dann “Image elements do not have explicit * width and height”, der…Continue reading