0
0
Wordpressframework~20 mins

Lazy loading in Wordpress - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Lazy Loading Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
What happens when lazy loading is enabled on images in WordPress?

Consider a WordPress site where images have the loading="lazy" attribute added automatically. What is the main effect on page loading?

AAll images load immediately when the page starts loading, increasing page speed.
BImages load only when they are about to enter the browser's viewport, reducing initial page load time.
CImages are replaced with placeholders and never load unless clicked.
DImages load in a random order regardless of their position on the page.
Attempts:
2 left
💡 Hint

Think about how lazy loading delays image loading until needed.

📝 Syntax
intermediate
1:30remaining
Which HTML attribute enables lazy loading for images in WordPress?

WordPress automatically adds an attribute to images to enable lazy loading. Which attribute is it?

Adefer="true"
Blazyload="enabled"
Cloading="lazy"
Dasync="true"
Attempts:
2 left
💡 Hint

It is a standard HTML attribute recognized by modern browsers.

🔧 Debug
advanced
2:30remaining
Why does lazy loading not work on background images set via CSS in WordPress?

Lazy loading works on <img> tags but not on background images set with CSS. Why?

ABecause CSS background images are not part of the DOM's <code>&lt;img&gt;</code> elements and cannot use the <code>loading</code> attribute.
BBecause WordPress disables lazy loading for all CSS files by default.
CBecause background images load only after JavaScript runs, so lazy loading is unnecessary.
DBecause lazy loading only works on images smaller than 100KB.
Attempts:
2 left
💡 Hint

Think about how lazy loading is implemented in browsers.

state_output
advanced
2:00remaining
What is the effect on page speed score when lazy loading is disabled in WordPress?

If you disable lazy loading for images in WordPress, what is the most likely effect on your page speed score?

APage speed score becomes unpredictable and varies randomly.
BPage speed score increases because images load faster without lazy loading.
CPage speed score remains the same because lazy loading does not affect speed.
DPage speed score decreases because all images load immediately, increasing initial load time.
Attempts:
2 left
💡 Hint

Consider how loading all images at once affects load time.

🧠 Conceptual
expert
3:00remaining
Which WordPress function can you use to disable lazy loading for a specific image?

You want to disable lazy loading for one image in WordPress while keeping it enabled globally. Which function or filter helps you do this?

AUse the <code>wp_lazy_loading_enabled</code> filter to return false for that image's ID.
BUse the <code>disable_lazy_load()</code> function directly on the image tag.
CAdd <code>loading="eager"</code> attribute to the image tag to override lazy loading.
DUse the <code>remove_lazy_loading()</code> function in the theme's functions.php file.
Attempts:
2 left
💡 Hint

WordPress provides a filter to control lazy loading per image.