Questions tagged [block-editor]

The Block Editor is the 'new publishing experience' slated for introduction in WordPress 5.0, replacing TinyMCE and other aspects of the default editing experience. Find out more at https://wordpress.org/gutenberg/

Filter by
Sorted by
Tagged with
0
votes
0answers
31 views

Run function after loading components into gutenberg editor sidebar

I would like to run a function after I load the meta box/components into the sidebar just in the gutenberg editor. I know I could do it with add_action('add_meta_boxes'), but the function I want to ...
1
vote
1answer
42 views

How to target block variations with has_block()?

We often use has_block to enqueue scripts only if a certain block is present. With something like vimeo you used to be able to write has_block('core-embed/vimeo'). What is the proper way now to ...
0
votes
0answers
13 views

Block patterns no longer showing in editor despite showing as registered

Since the latest release (5.8), some of my block patterns no longer show on the block patterns panel. Dumping a list of registered block patterns shows those missing patterns as registered but they ...
2
votes
1answer
141 views

Find if widget block is active

I'm used to check if a widget from installed my plugin is active. With the new block editor extending to widgets in WordPress 5.8, I was wondering if there is a way to check the widget block that I ...
0
votes
0answers
17 views

WordPress post using block editor displays error when adding the string "cmd.exe"

Today a member of our content team reported that when they attempted to save a post in block editor mode, they continually received an error. Updating failed. The response is not a valid JSON response....
0
votes
0answers
41 views

Has blocks gutenberg block multiples registers type in my Plugin

I created a plugin that contains multiple blocks and I want it to load assets only if I have one of those blocks created. Is there any way to get all blocks registered by my plugin? The idea with this ...
0
votes
1answer
30 views

Is there a way to grab the current value of the editor in Gutenburg/Classic Wordpress editor? (Not the saved value of the post!)

I'm trying to make my plugin "Gutenburg - compatible". I have some issues when replacing the editors contents. Before I could just change value by using #content but with Gutenburg there's ...
0
votes
2answers
309 views

Block Controls not showing

I'm building my first Gutenberg block and the problem that I have is that the block control toolbar doesn't show. I've spend hours comparing my code with other Gutenberg blocks, but couldn't find what ...
2
votes
0answers
94 views

How to disable Widget Gutenberg Blocks?

I was looking for how to deactivate the widget blocks that appeared with version 5.8 of Wordpress and I couldn't find it here. As I found the answer elsewhere, I share it here. So, to disable widget ...
0
votes
0answers
38 views

Custom ACF block only outputs commented JSON to the DOM

I created several custom ACF blocks and all but one are working properly. This one in particular only outputs commented out JSON to the DOM. Here's what it's displaying (with a few string values ...
0
votes
0answers
21 views

Add data-attribute to Gutenberg block [duplicate]

I have looked around and couldn't find a solution for this, what I am looking to do is add a data-attribute to the Gutenberg block The perfect place for it would be the "Advanced" section ...
1
vote
1answer
197 views

How can we mimic the columns block in Gutenberg to instead be a list?

How can we mimic the columns block in Gutenberg to instead be list elements? I wish I can provide an example, but I have 0 clue on a starting point for this one. Here's my best explanation...Instead ...
1
vote
0answers
91 views

ACF custom block get_field() shows null on front-end? [closed]

I built a custom block using ACF acf_register_block_type(); function it works fine in the WordPress dashboard (block editor), it shows the field data and all good.. but in the front-end (view page) ...
1
vote
1answer
100 views

Adding an html wrapper to a custom Block Pattern

I've registered a custom block pattern using register_block_pattern with several block elements, and I'd like to wrap the whole thing in a container element. When I add it to the content, however, it ...
4
votes
2answers
713 views

How can I see a list of pages and post where my custom Gutenberg block is used?

Background: Creating Custom Gutenberg Blocks and the Challenges with Breaking Changes I am new to creating custom Gutenberg blocks (each block is a separate plugin) and have recently ran into the ...
0
votes
0answers
42 views

props.toggleSelection doesn't work

I'm trying to force the block selection to true in my custom gutenberg block using the edit.props.toggleSelection function (by selection I mean to show the border around the block and display the ...
0
votes
0answers
52 views

Video Block does not autoplay

When adding a video block to my page and setting the video to muted autoplay and playsinline appears that the block does not contain all attributes and I ended up with a static image. Does anyone know ...
1
vote
0answers
70 views

Rendering javascript in render_callback php Code

I've got a block-based plugin that displays a leafletjs map. The map displays perfectly in a WP Post. However, in the block editor, the map fails to display. The heading2, 'Leaflet.js Map' shows, with ...
2
votes
0answers
107 views

How to support Lazy Loading Assets in a WordPress Theme?

I'm using the create-block module provided in Gutenberg Core to build my custom blocks within a plugin. It works great, but I'm struggling to figure out how to conditionally load the assets on the ...
0
votes
1answer
153 views

How to create pre-designed page layouts for Gutenberg?

Prior to the block editor, I would create pre-designed page layouts for my clients using the following method: Create a page template file. For example, about-us.php, in the theme folder. Use the ...
0
votes
1answer
26 views

Issue with translation - Gutenberg

Here is my code. I based it on CapitaineWP formation and template. I have the .pot, .po, .mo and .json files. $script_asset_path = PERSO_FOLDER."/build/index.asset.php"; if ( ! file_exists( $...
0
votes
0answers
57 views

How to Add predefined CSS Classes to a Block using Gutenberg

im trying to add something like a select field to a Gutenberg Block, so the user can select wich class he wants for the block. The user should not type in a additional class, he should select from a ...
0
votes
0answers
17 views

Enable Gutenberg for attachment edit page

I'm trying to get Gutenberg working when you edit media details (attachment post type). This is what I have so far: add_filter( 'register_post_type_args', function( $args, $post_type ){ if ( '...
1
vote
1answer
90 views

Reset <LinkControl /> data when the field is cleared

I was able to get the values to save, but now I'm running into issues unsetting the value when the data is removed from the control. I've tried the onRemove function as suggested in the documentation ...
-1
votes
2answers
76 views

Block validation failed

I wrote a specific block for a customer. It is working well. I fill the data. I save and when I look on the website, it is quite perfect. But, when I refresh the editor, I am receiving this error. ...
0
votes
1answer
98 views

How to display post content in the block editor

I'm building a block that shows a bunch of posts of a custom post type. This is the loop that prints them: { customposts.map( ( custompost, index ) => { return <div key={ index } className=&...
0
votes
1answer
68 views

Combine multiple getEntityRecords calls

I have a block that references a custom post type named faq that has a taxonomy named faq_group. This block has one attribute and makes multiple getEntityRecords calls. One of the calls has an ...
2
votes
1answer
107 views

Get term by slug in Gutenberg

In Gutenberg, one can use the getEntityRecord selector to get the data of a term of a specific taxonomy by its term id: // Get the category term with term id = 25 const term = useSelect( ( select ) =&...
2
votes
1answer
31 views

Compatability of gutenberg block in older WordPress version

I'm developing a Gutenberg block and have a doubt on using the latest gutenberg APIs. My block contains a button. Referring the docs, there is a property called "variant" using which the ...
0
votes
1answer
108 views

Gutenberg dynamic block render_callback gives null for $post

I am trying to get the current post ID in the render_callback function to generate related posts. However, the global $post object gives null. I use this code for example from here: add_action( 'init',...
0
votes
0answers
25 views

Reducing CSS Build size in Gutenberg plugin

We have created a Gutenberg plugin using React JS. This plugin has around 25 blocks to create designs. It is creating the final build file around 2MB which is reducing the speed of our blog. Here is ...
0
votes
0answers
21 views

How to override core/paragraph onChange handler

Below is the code, in this case it replacing the original core/paragraph with RichText and removes the original core/paragraph setting panel. How can I override only onChange handler of core/paragraph ...
3
votes
1answer
191 views

Gutenberg Block manipulation: Undo parse_blocks() with serialize_blocks() results in unicode issues

I would like to manipulate Gutenberg Blocks with PHP. Therefore I need to parse post_content into an array and the same way back after manipulation. But I don't get that far, because already the ...
0
votes
1answer
115 views

How to load an additional script for a block in the block editor?

I'm developing a dynamic block that prints the following markup (for example) using the ServerSideRender component: <div class="accordion"> <h3 class="accordion-title"&...
1
vote
1answer
69 views

Guttenberg Implementation on Front Page

Is it possible to implement Guttenberg editor on some custom frontend page like we can do tinyMCE using wp_editor()?
1
vote
0answers
168 views

How to override gutenberg paragraph block edit property

I want to change gutenberg core paragraph block. My exact problem is... I need to count the characters of the first paragraph. If the number is greater than the specified number, add a class to that ...
4
votes
1answer
85 views

WordPress <LinkControl /> Value of Undefined in Admin

I'm trying to create a basic link control in my WordPress plugin, but I can't get it to work properly. I 've read the previous answers on here, but still having issues. I also checked out the block-...
1
vote
1answer
53 views

Check for Active WordPress Plugins from the Block Editor

StackExchange Community, I am working on some Block Editor formats and blocks and would like to add a check to see if a certain plugin is installed. This would be specific to the back-end admin area ...
0
votes
0answers
38 views

ResizableBox component is not selectable in block editor

Trying to replicate the core/spacer block as a class component but having no success. From my tinkering it seems like spreading useBlockProps() on a wrapper for a ResizeableBox also makes that wrapper/...
0
votes
1answer
163 views

Wordpress block editor embeds not working in theme (single.php)

I am trying to embed 'spotify' and 'youtube' services in the block editor. When added from the admin, they are displayed fine in the block editor, but when the post content is printed from the theme (...
0
votes
0answers
62 views

Fixed: Console.log twice in the edit function

Hi Guys I am using $ npx @wordpress/create-block todo-list package and I found something interesting. I have not changed everything in the file structure but my console.log or any variable get ...
0
votes
3answers
913 views

Remove WooCommerce block styles

I'm working on a custom WooCommerce theme, and ideally would like to use the stable Gutenberg blocks shipped with WooCommerce. Obviously, instead of over-riding all of their styles with my own to ...
1
vote
1answer
340 views

How do I access site and block editor state data and use `useSelect()` or `withSelect()` to bind it to my components?

Where does the Gutenberg store site and Block Editor state data, how do I access it, and how can I use it in block and sidebar components so that they will update and re-render automatically when it ...
0
votes
1answer
47 views

How to get the Gallery form/section just like in Gutenberg block?

I am making a custom php page in wp-admin and required to upload multiple images and display it after upload and select images to display. Basically I would like to have the same effect as in Image ...
1
vote
1answer
466 views

InnerBlocks breaks Flexbox and CSS Grid styles

When using InnerBlocks so you can nest parent/child blocks you end up with additional HTML (in the editor) wrapping the child elements like so: <div class="PARENT"> <div class=&...
0
votes
2answers
211 views

How to select block variation from BlockVariationPicker

I have a custom block that has block variations. If I make the scope of the variations "inserter", they work as expected. But if I make the scope "block" and use ...
1
vote
1answer
645 views

How to transform a legacy widget into a block

WP 5.8 (not released yet) will include support for transforming legacy widgets into blocks. I have a custom legacy widget I'm trying to add support for transforming it into a block. Reading the docs I ...
1
vote
1answer
94 views

Gutenberg: Block validation Failed Richtext undefined

I am building a custom block to add a youtube-video as a background-video that autoplays and infinite loops when you visit the site. To make this happen the user needs to get the video-link and ...
1
vote
1answer
75 views

Gutenberg Block showing invalid content on edit

My requirement: I am trying to create a simple gutenberg block which will have a textarea and a dropdown. Once a user has provided the details I want to save it as a shortcode in DB, but when the user ...
0
votes
0answers
180 views

Gutenberg Custom Block RichText removes toolbar when not focused

I am creating some custom blocks for gutenberg, and everything was going fine. But when I add the <RichText /> component from @wordpress/block-editor The default toolbar that is showing above a ...

1
3 4
5
6 7
27