WP_Query not using relation key as expected and not producing any results

From the developer docs: relation (string) – The logical relationship between each inner meta_query array when there is more than one. Possible values are ‘AND’, ‘OR’. Do not use with a single inner meta_query array. (Emphasis mine). It’s a bit hacky, but you could run a separate query against the meta field, then merge the … Read more

Adding “Changelog” as a second tab to the auto updater custom plugin

I believe you have to add it into your plugin data array, see below: $packages[‘plugin-slug’] = [ ‘versions’ => [ ‘1.0.0’ => [ ‘name’ => ‘WP Awesome Plugin’, ‘version’ => ‘1.0.0’, ‘new_version’ => ‘1.0.0’, ‘date’ => ‘2023-02-10 14:17:00’, ‘tested’ => ‘6.1.1’, ‘package’ => ‘https://127.0.0.1/plugin-slug-1.0.0.zip’, // ‘author’ => ‘<a href=”https://127.0.0.1/”>Author</a>’, ‘author_profile’ => ‘https://127.0.0.1/’, ‘homepage’ => ‘https://127.0.0.1/wordpress-plugins/plugin-slug/’, … Read more

Consistent inline styling in a Gutenberg-paragraph-block

To add custom options to that dropdown, you’d want to look at utilizing the Formatting API. Below are the main points quoted from the Block Editor Handbook step-by-step guide: Step 1: Register a new format The first step is to register the new format, add src/index.js with the following: import { registerFormatType } from ‘@wordpress/rich-text’; … Read more

the function do_settings_section($page) generate error “Allowed memory size of … bytes exhausted”

You seem to be creating a recursive loop. In stm_addmenu_auto_delete_event(), you register an admin page via add_menu_page() that has a callback of auto_delete_settings_callback: function stm_addmenu_auto_delete_event() { add_menu_page( ‘Automatic deletion’, ‘Automatic <br/> deletion’, ‘manage_options’, ‘manage-auto-delete-page’, ‘auto_delete_settings_callback’, In new_settings_auto_delete you register a settings field with a callback of auto_delete_settings_callback: function new_settings_auto_delete() { // … add_settings_field( ‘default_auto_delete_field’, ‘By … Read more

Custom Gutenberg block within column block selection and update issue

You seem to have useBlockProps() and extra props outside of this hook: <div { …useBlockProps() } className=”card” style={{ backgroundImage: `url(${imageUrl})`}} > Your className would override any className value provided by the useBlockProps(), potentially causing the undesired behavior. Instead, consider merging the props into the props that would be emitted by useBlockProps() by passing them into … Read more

Translations not making it into Block UI but work in the rest of the plugin

It seems like you do not have any JavaScript localization files to use with wp_set_script_translations(). If we consult the Gutenberg/JavaScript documentation for internationalization: The translation files must be in the JED 1.x JSON format. […] <?php function myguten_set_script_translations() { wp_set_script_translations( ‘myguten-script’, ‘myguten’, plugin_dir_path( __FILE__ ) . ‘languages’ ); } add_action( ‘init’, ‘myguten_set_script_translations’ ); WordPress will … Read more

Redirect OLD/Path to NEWURL/Path

<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^olddomin\.com RewriteRule ^(.*)$ https://newdomain.com/$1 [R=301,L] </IfModule> This is what you’re looking for, before the WP block in your .htaccess.

How can I get the number of items stored under a cache group

Here is an untested one-liner, counting the cache data array returned from the magic __get method, with a fallback to an empty array if the group key is not set: ‘numberOfEntries’ => count( $wp_object_cache->cache[$group] ?? [] ); Another approach is to consider bindTo to access the private cache array of the $wp_object_cache instance via closure.