wordpress-modern

Enable on-demand loading for WordPress block assets and scripts.

2|Updated Nov 7, 2025
One-click install
npx skills add https://github.com/mikkelkrogsholm/wp-plugins --skill wordpress-modern
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wordpress-modern
Source: https://github.com/mikkelkrogsholm/wp-plugins/tree/main/.claude/skills/wordpress-modern
Command: npx skills add https://github.com/mikkelkrogsholm/wp-plugins --skill wordpress-modern

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers leverage the latest WordPress 6.8+ features to significantly improve website performance, reduce load times, and enhance user experience through optimized asset loading and caching strategies. It ensures your site remains fast and competitive.

Core Features & Use Cases

  • On-Demand Asset Loading: Implement conditional loading for block assets, ensuring scripts and styles are only loaded when their corresponding blocks are present on the page, reducing initial page weight.
  • Speculative Loading: Configure browser speculation rules to prefetch or prerender critical pages, dramatically improving perceived load times for users by anticipating their next move.
  • Caching Strategies: Utilize transients and object caching to store expensive query results and reduce database load, boosting overall site speed and responsiveness.
  • Use Case: Optimize a WooCommerce product page. This Skill guides you to enable on-demand loading for product-specific blocks, configure speculative loading for related product pages, and cache product data using transients to ensure lightning-fast load times and a seamless shopping experience.

Quick Start

Outline how to enable on-demand asset loading for a custom WordPress block named 'my-product-block'.

Frequently Asked Questions about wordpress-modern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce WordPress page load times with asset optimization?

Asset optimization in WordPress 6.8+ reduces page weight by loading scripts and styles only when their corresponding blocks appear on the page. Enable on-demand loading through the should_load_block_assets_on_demand filter to conditionally enqueue assets per-page, eliminating unnecessary downloads and speeding up initial render.

What is speculative loading and how does it improve WordPress performance?

Speculative loading uses browser speculation rules to prefetch or prerender anticipated pages before users navigate to them. WordPress 6.8+ implements this via wp_speculation_rules and wp_load_speculation_rules hooks, dramatically reducing perceived load times by preloading critical resources and content in advance.

Can I use transients and object caching to speed up WordPress queries?

Yes. Transients store expensive query results temporarily, and object caching reduces repeated database hits. Both strategies lower database load and boost responsiveness, particularly for product pages and content-heavy sites. Implement transient storage via WordPress caching API to cache product data and derived results.

How do I enable on-demand asset loading for custom WordPress blocks?

Register conditional asset loading for custom blocks by hooking into should_load_block_assets_on_demand and wp_enqueue_scripts. Use block detection logic to load scripts and styles only when the block is present, reducing initial page weight and improving performance across your site.

Does on-demand asset loading work with WordPress admin and AJAX endpoints?

Yes. On-demand asset loading integrates with admin_init for backend optimization and supports AJAX handlers secured with nonce checks. Activation and deactivation hooks ensure clean setup and teardown, making the approach compatible with administrative interfaces and dynamic content loading.

What WordPress version do I need for performance optimization with caching and speculative loading?

WordPress 6.8 or later is required. This version introduced native support for on-demand block assets, speculation rules, and integrated caching mechanisms. Older versions lack these features, so upgrading ensures access to the latest performance optimization tools and best practices.