Black Friday 40% off yearly and lifetime plans · 18d left Ends in 18d09h23m Claim 40% off
Performance48 docs

How to Use Selective Media Preload in WordPress

Preload selected media files and custom URLs on specific WordPress posts and pages with Classic Monks. Improve LCP without preloading every asset site-wide.

By Founder & Lead Developer

Last updated

3 minutes

Key takeaways

  • Separate feature from Intelligent Preloading
  • Adds a Media Preload Settings metabox to enabled post types
  • Supports selected Media Library attachments
  • Optional custom URL preloads
  • Supports scope modes for selected post types
  • Maximum of 10 total media files and URLs per post
  • Best used for LCP images and other critical above-the-fold media

What Is Selective Media Preload?

Selective Media Preload outputs <link rel="preload"> tags for media you select on individual posts and pages. It is designed for cases where you know the exact asset that should load early, such as a hero image, featured image, logo, or critical video.

This is different from:

  • Lazy Loading, which defers non-critical resources until they approach the viewport
  • Critical Image Preload, which detects common above-the-fold patterns
  • Intelligent Preloading, which predicts likely next pages and preloads links

Selective Media Preload is explicit and page-specific. You choose the assets yourself.

How to Enable Selective Media Preload

  1. Step 1

    Open the Performance settings

    In WordPress admin, open Classic Monks > Performance and select the Preloading subtab.

  2. Step 2

    Enable the feature

    Enable Enable Selective Media Preload.

    Preloading settings for website performance

  3. Step 3

    Choose the scope mode

    Configure Scope Mode and choose which post types receive the metabox:

    • Only on selected post types
    • Except on selected post types
    • On all post types

    Scope mode dropdown options

    Select the post types that match your content workflow.

  4. Step 4

    Enable custom URLs if needed

    Enable Enable Custom URL Preload Method if you need to preload an asset that is not in the WordPress Media Library.

    Use this for a CDN-hosted image, video, font, or other resource that is safe and appropriate to preload.

  5. Step 5

    Save the settings

    Click Save Changes.

  6. Step 6

    Open a supported post or page

    Edit a post or page whose post type matches your scope settings. Look for the Media Preload Settings metabox.

  7. Step 7

    Add critical media

    Click Add Media and select the files that must load early. Add the largest or most important above-the-fold images first. Use Clear All to remove the current selection and rebuild the list.

  8. Step 8

    Add custom URLs (optional)

    If custom URL support is enabled, click Add URL and enter a complete valid URL. Select the correct resource type through the URL extension and verify that the URL is publicly accessible.

  9. Step 9

    Save the post

    Update or publish the post. Classic Monks stores the selected media IDs and URLs as post metadata and outputs preload tags on the frontend.

How to Choose What to Preload

Prioritize assets that affect the first viewport and LCP:

  1. Hero image
  2. Featured image visible immediately on the page
  3. Site logo when it is the LCP element
  4. Critical above-the-fold video poster or video
  5. A small number of other assets required for the first render

Do not preload every image. The implementation limits the total to 10 items, and the UI recommends keeping the list to approximately 3–5 critical files or URLs.

Configuration Options

Option Description Default
Enable Selective Media Preload Enables the post-editor metabox and frontend preload output. Off
Enable Custom URL Preload Method Allows custom URLs in addition to Media Library attachments. Off
Scope Mode Controls which post types receive the metabox. Only on
Selected Post Types Post types included or excluded by the scope mode. Empty
Maximum total items Maximum combined media files and custom URLs per post. 10

Verify the Generated Preloads

Browser test

  1. Open the published post in a logged-out private window.
  2. View the page source or inspect the document head.
  3. Search for Classic Monks Selective Media Preload.
  4. Confirm each selected asset has a corresponding <link rel="preload"> tag.
  5. Open DevTools > Network and reload the page.
  6. Confirm the selected asset starts loading early.
  7. Confirm non-selected below-the-fold assets are not accidentally preloaded.

LCP test

Run the page through Lighthouse or PageSpeed Insights before and after adding the preload. Record:

  • LCP element
  • LCP request start time
  • LCP resource priority
  • Total transfer size
  • Any preload warnings

Only keep the preload if it improves the actual critical rendering path. An unnecessary preload competes with CSS, fonts, or other critical resources.

Developer Notes

Implementation: functions/performance/selective-media-preload.php.

Relevant options and metadata:

  • enable_selective_media_preload
  • enable_selective_media_preload_urls
  • selective_media_preload_mode
  • selective_media_preload_post_types
  • _cm_preload_media
  • _cm_preload_urls

The feature registers add_meta_boxes, save_post, wp_head, wp_img_tag_add_loading_attr, wp_preload_resources, and admin_enqueue_scripts hooks/filters. It limits the combined media and URL selection to 10 items per post.

Troubleshooting

6 problems and how to fix each one.

The metabox is not visible

Cause: The feature is disabled, the current post type is outside the configured scope, or the post type is not public.
Fix: Enable the feature, check Scope Mode, select the current post type, and reload the editor.

The custom URL field is not visible

Cause: Enable Custom URL Preload Method is disabled.
Fix: Enable it in Performance > Preloading, save settings, and reload the editor.

The preload tag is not in the page source

Cause: The post type is not enabled, no media was saved, or the post is not a singular frontend view.
Fix: Confirm the post type scope, save the post again, and test the published singular URL.

The selected image still has lazy-loading behavior

Cause: Another optimization layer is rewriting the markup, or the image was not recognized as a selected preload asset.
Fix: Check the generated preload tag and the image’s loading attributes. Disable competing optimization systems and retest.

The page became slower after adding preloads

Cause: Too many assets are competing for early bandwidth.
Fix: Remove non-critical items. Keep only the 3–5 assets that directly affect the first viewport or LCP.

A custom URL does not preload

Cause: The URL is invalid, inaccessible, or the extension does not map to a known media type.
Fix: Verify the URL from the server’s perspective, use HTTPS, and check the generated as and type attributes in the page source.

Was this doc helpful?

Your answer tells us which docs to fix first.

Still stuck? Ask on the forum or email help@classicmonks.com.
Joy Chetry
Written by the person who built it

Joy Chetry

Founder & Lead Developer, Classic Monks

Joy is the founder of Classic Monks and GoodMonks Solutions, a web development agency that builds WordPress and WooCommerce sites for clients. Classic Monks grew out of the agency's own need to consolidate 20 to 30 separate plugins into one core stack.

Follow this doc on a real site.

Open a private WordPress site with Classic Monks, WooCommerce and Bricks Builder installed, and follow this doc step by step. Free for 24 hours, no card.

280 docs, written by Joy Chetry 15 day refund window