how to run tests using different db connection

Changing the DB connection used by a WPDB object that already exists or passing it a mysqli instance is not possible. And if it was, it still wouldn’t work for other reasons. if you want to access a new database connection you need to create a new WPDB instance: $second_db = new WPDB( ‘dbuser’, ‘dbpassword’, … Read more

Add custom data attribute to every core Gutenberg Blocks

I found the solution: I removed addFilter(‘blocks.getSaveContent.extraProps’, ‘luxuryconcept/add-custom-props’, addCustomProps); as @TomJNowell recomended. I added the add_filter(‘render_block’, ‘theme_custom_add_custom_attributes’, 10, 2); PHP code to functions.php: So, here all the working code: JS: /** * * Extends Core Gutenberg Blocks functionalities * * @description Add data-delay and data-duration attributes to every Gutenberg Core Blocks * @package luxuryconcept * … Read more

No aspect ratio selector in a custom block

Per the developer handbook: This value signals that a block supports some of the CSS style properties related to dimensions. When it does, the block editor will show UI controls for the user to set their values if the theme declares support. So in your theme you’ll need to declare support either by setting appearanceTools … Read more

Why would I get a “Trying to access array offset on value of type bool” warning when using “metadata_exists()” in save_post?

Thanks to mmm’s comment above, it was pointed out that even for CPTs the first parameter’s value needs to be “post”, as clearly stated in the documentation at https://developer.wordpress.org/reference/functions/metadata_exists/. Somewhere along the way I confused myself into thinking that the first parameter’s value needed to be the CPT handle for a custom post type (CPT), … Read more

WordPress replace howdy function now throwing deprecated warning

Thank you @mmm that helps! Setting the priority to 9992 allows this function to work in WP V6.6 /** ============================================================= * replace WordPress Howdy in Admin Bar with Hi in WordPress 6.6+ * or remove howdy (replace with nothing) */ function replace_howdy( $wp_admin_bar ) { $my_account = $wp_admin_bar->get_node(‘my-account’); if ( isset( $my_account->title ) ) { … Read more