$m in pre_do_shortcode_tag

The documentation for $m is available in the function that the pre_do_shortcode_tag filter gets called in, do_shortcode_tag(): /** * … * @param array $m { * Regular expression match array. * * @type string $0 Entire matched shortcode text. * @type string $1 Optional second opening bracket for escaping shortcodes. * @type string $2 Shortcode … Read more

What’s the point of the default .htaccess?

Ok, I figured this out: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] The single dot in the 3rd line matches any single character, but the replacement applies to the whole string. So, whatever URL you asked for, if it doesn’t match an existing file or directory name, is turned into a request … Read more

Generate list of posts on a page, but fill shortcode values from ACF fields on that page

I have actually found a really elegant solution to this myself. The issue is not with the [random-posts-list], it is with the script used to generate the [county] shortcode. Instead of using $post_ID = get_the_ID(); I should have been using $post_ID = get_queried_object_id();. This is a built-in WordPress query. With the above amend, I also … Read more

Correct filter hook to modify the output of a custom taxonomy API call?

The rest_grammar_terms_query hook should normally fire, but it’s possible that when registering the custom taxonomy or defining the API endpoint, that hook wasn’t applied or the wrong namespace was used. One approach would be to try using register_rest_field() or the rest_prepare_<taxonomy> filter. For example, rest_prepare_grammar_terms can be used to modify the API response of your … Read more

Your site doesn’t include support for the “*” block. You can leave it as-is or remove it

You’re getting that notice because your JavaScript code resulted in the following error: ReferenceError: Cannot access ‘EditComponent’ before initialization This means you need to register your block after the constants EditComponent and SaveComponent are defined. // Define the constants first. const EditComponent = …; const SaveComponent = …; // Then register your block. registerBlockType(‘eternaltwentyfifteen/prevnext’, { … Read more

Importing Google Fonts in Block Themes — Correct Way

Make sure the layout.css file is called correctly, both on the frontend and backend. No need to add fontFace, you have called it via @import : { “$schema”: “https://schemas.wp.org/trunk/theme.json”, “version”: 3, “settings”: { “layout”: { “contentSize”: “700px”, “wideSize”: “1200px” }, “typography”: { “fontFamilies”: [ { “fontFamily”: “\”PT Sans\”, sans-serif”, “name”: “PT Sans”, “slug”: “pt-sans” }, … Read more

Hide parent link in submenu on admin menu

As @Tom J Nowell pointed out in the comments, using the same slug for the admin menu and the first submenu has the effect of removing the repeated menu name in the submenu. function newintranet_tabs_admin_menu_option() { add_menu_page(‘CMC Intranet Tabs’, ‘CMC Intranet Tabs’, ‘manage_options’, ‘newintranet_tabs_admin_menu’, ‘newintranet_tabs_scripts_page’, ”, 200); add_submenu_page(‘newintranet_tabs_admin_menu’, ‘Add Tabbed Page’, ‘Add Tabbed Page’, ‘manage_options’, … Read more