0
0
Wordpressframework~20 mins

Image optimization in Wordpress - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
WordPress Image Optimization Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding WordPress Image Sizes
In WordPress, what is the purpose of the add_image_size() function?
AIt registers a new custom image size to be generated when images are uploaded.
BIt compresses existing images in the media library to reduce file size.
CIt deletes unused images from the media library to save space.
DIt converts images to WebP format automatically on upload.
Attempts:
2 left
💡 Hint
Think about how WordPress creates different image versions for different uses.
component_behavior
intermediate
2:00remaining
Behavior of Lazy Loading in WordPress
What happens when you enable native lazy loading for images in WordPress?
AImages are converted to SVG format for faster rendering.
BAll images load immediately but at a lower resolution to save bandwidth.
CImages load only when they are about to enter the browser viewport, improving page speed.
DImages are preloaded before the page content to avoid delays.
Attempts:
2 left
💡 Hint
Lazy loading delays image loading until needed.
📝 Syntax
advanced
2:00remaining
Correct Syntax for WebP Support in WordPress
Which code snippet correctly enables WebP image support in WordPress by adding WebP to allowed mime types?
Aadd_filter('mime_types', function($mimes) { $mimes['webp'] = 'image/webp'; return $mimes; });
Badd_filter('mime_types', function($mimes) { $mimes['webp'] = 'image/jpeg'; return $mimes; });
Cadd_action('mime_types', function($mimes) { $mimes['webp'] = 'image/webp'; });
Dadd_filter('upload_mimes', function($mimes) { $mimes['webp'] = 'image/png'; return $mimes; });
Attempts:
2 left
💡 Hint
Check the correct hook and mime type for WebP.
🔧 Debug
advanced
2:00remaining
Debugging Image Compression Plugin Conflict
A WordPress site uses two image compression plugins. After activating both, images are not compressed properly. What is the most likely cause?
AThe server does not have enough storage space for compressed images.
BWordPress does not support image compression plugins.
CThe images are already compressed and cannot be compressed further.
DThe plugins conflict because both try to compress images on upload, causing errors.
Attempts:
2 left
💡 Hint
Think about how plugins might interfere with each other.
state_output
expert
3:00remaining
Result of Custom Image Size Usage in Theme
Given this code in a WordPress theme's functions.php:
add_image_size('custom-thumb', 300, 200, true);
the_post_thumbnail('custom-thumb');

What will be the output behavior when displaying the post thumbnail?
Wordpress
add_image_size('custom-thumb', 300, 200, true);
the_post_thumbnail('custom-thumb');
AThe post thumbnail is displayed at original size ignoring the custom size.
BThe post thumbnail is displayed cropped to exactly 300x200 pixels.
CThe post thumbnail is displayed stretched to 300x200 without cropping.
DThe_post_thumbnail function throws an error because 'custom-thumb' is not a default size.
Attempts:
2 left
💡 Hint
Check the meaning of the last parameter in add_image_size.