• For the Below Navigation Image, in WordPress also called Header Image, the width and height attributes are missing. This slows down page rendering, especially on mobile devices.

    Current code in header.php, line 111:

    <img src="<?php echo esc_url(( get_header_image()) ); ?>" alt="<?php echo( get_bloginfo( 'title' ) ); ?>" />

    Suggested fix:

    <?php echo get_header_image_tag( array( 'alt' => get_bloginfo( 'title' ) ) ); ?>

    Example output of fix with attributes present:

    <img src="[redacted]/wp-content/themes/responsiveblogily/inc/starter_content/img/header-img.statopt_ver.1755767639.png" width="1200" height="500" alt="My WPSandbox site" decoding="async" fetchpriority="high" />

    ResponsiveBlogily 7.2, WordPress 6.8.2

Viewing 1 replies (of 1 total)
  • Thread Starter Ov3rfly

    (@ov3rfly)

    The suggested fix also provides proper srcset and sizes attributes with larger images and speeds up loading on mobile devices a lot, example output:

    <img src="[redacted]/wp-content/uploads/2025/08/[redacted].jpg" width="1180" height="550" alt="My WPSandbox site" srcset="[redacted]/wp-content/uploads/2025/08/[redacted].jpg 1180w, [redacted]/wp-content/uploads/2025/08/[redacted]-300x140.jpg 300w, [redacted]/wp-content/uploads/2025/08/[redacted]-1024x477.jpg 1024w, [redacted]/wp-content/uploads/2025/08/[redacted]-768x358.jpg 768w, [redacted]/wp-content/uploads/2025/08/[redacted]-850x396.jpg 850w" sizes="(max-width: 1180px) 100vw, 1180px" decoding="async" fetchpriority="high" />
Viewing 1 replies (of 1 total)

The topic ‘Below Navigation Image, width and height attributes missing’ is closed to new replies.