3

WordPress has some global actions you can use here. If you want to add your own notice in the lower corner (like the screenshot), you can do that like this: wp.data.dispatch("core/notices").createNotice( "success", // Can be one of: success, info, warning, error. "This is my custom message.", // Text string to ...


2

By default it's the MD5 hash of the site URL: $siteurl = get_site_option( 'siteurl' ); if ( $siteurl ) { define( 'COOKIEHASH', md5( $siteurl ) ); } This includes the scheme but not a trailing slash, so in your example you'd need the hash of https://zeth.dk. You can also override this by defining COOKIEHASH in wp-config.php with some ...


2

so I'm not sure the enqueuing is even happening No, it's not, because you only registered the scripts, but never enqueued them — which should be done using wp_enqueue_script(). Also, you should make frogaloop as a dependency for your snippet.js script. Hence, register the frogaloop script before your snippet.js script. // Register the scripts. ...


2

You can do this with the editor.BlockListBlock filter. More info here. This allows you to do something like the following: const withCustomAttributeClass = createHigherOrderComponent( ( BlockListBlock ) => { return ( props ) => { const { attributes } = props; const { yourCustomAttribute } = attributes; const class = ...


1

The code referenced in your question is still good. I double checked, and this worked for me: function wpse_script_loader_tag( $tag, $handle ) { if ( 'jquery-fluidbox' !== $handle ) { return $tag; } return str_replace( ' src', ' data-cfasync="false" src', $tag ); } add_filter( 'script_loader_tag', 'wpse_script_loader_tag', 10, ...


1

I have no words 🤦‍♂️ A simple change dirname(plugin_basename(__FILE__)) . '/languages/' inside wp_set_script_translations() function (3rd argument) to plugin_dir_path(__FILE__) . 'languages/' fixed the problem


1

This is Trac ticket 51223: commonL10n and other JS globals removed without backwards compatibility In WordPress 5.5, the localized translations under commonL10n were replaced by wp.i18n.__ without deprecation notice or backwards compatibility. Plugins using commonL10n now have JavaScript errors introduced by updating WordPress which can break site ...


1

If you just want to get the selected color name, then you can use the getColorObjectByColorValue() function in the @wordpress/block-editor package, which is wp.blockEditor.getColorObjectByColorValue in the browser. The function accepts two parameters: a color list (each is an object with color and name as the properties), and the color (a HEX code, e.g. #...


1

The problem in your "edit" file is that your Edit() function in there is unpacking/destructuring the props, hence props is no longer defined or what you expected it to be. So you should do function Edit( props ) and not function Edit({className, props}) — and it should be noted that className is in that props, i.e. props.className. function Edit( ...


1

How the JS script works On page load, the script loads the post comments by making an AJAX request to a custom WordPress REST API endpoint at /tcm/v1/comments/<post ID> (here's a sample URL, valid as of writing). Then the script displays the comments sorted by the sort_field value in the comment localization parameters defined in the ...


Only top voted, non community-wiki answers of a minimum length are eligible