Gutenberg block.json Cheat Sheet
block.json is the canonical block manifest. name uses the namespace/block-name form. apiVersion: 3 opts in to iframe rendering for parity with the front end.Use render to point at …
Read article →block.json is the canonical block manifest. name uses the namespace/block-name form. apiVersion: 3 opts in to iframe rendering for parity with the front end.Use render to point at …
Read article →The lowest-risk migration: keep the classic theme, add theme.json, and start using block patterns and blocks alongside existing PHP templates. The site stays the same;…
Read article →Declare every dependency in the array: wp_enqueue_script('my', ..., ['wp-element', 'jquery']). WordPress resolves the load order automatically.For modules use wp_enqueue_script_mod…
Read article →For modern enqueues, wp_add_inline_script with a script handle is cleaner than wp_localize_script. It does not require a global variable name.For block editor data, use wp.data…
Read article →Always pass a sanitize_callback to register_setting(). Without one, anyone with the right capability can write arbitrary data into the option.Match the callback to the data:…
Read article →Check capabilities, never roles. current_user_can('manage_options') survives custom roles; current_user_can('administrator') breaks the first time someone adds a new admin-equivale…
Read article →Multisite makes sense when sites share users, themes, plugins, and a billing relationship — a university with department sites, an agency hosting clients with shared…
Read article →Every apply_filters() call has overhead — even with no hooked callbacks. On a hot path running thousands of times per request, that adds up.For inner-loop…
Read article →The Block Hooks API (WP 6.4+) lets a block declare it should auto-insert relative to another block. blockHooks in block.json maps target block names to…
Read article →When postmeta queries dominate your slow log, it is time for a custom table. dbDelta() with a CREATE TABLE statement on activation, then $wpdb queries…
Read article →