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
1answer
20 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 ...
1
vote
0answers
37 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
14 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
20 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 ...
2
votes
1answer
46 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
9 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
53 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 ...
2
votes
2answers
68 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
32 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
20 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
30 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 ...
1
vote
0answers
31 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
27 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
19 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
26 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
8 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
29 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
36 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
32 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
21 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 ...
1
vote
1answer
39 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
24 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
20 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
16 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
9 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 ...
1
vote
1answer
57 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
95 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
26 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
19 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
34 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
33 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
30 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
20 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
26 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
1answer
39 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
32 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
25 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 ...
0
votes
1answer
58 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=&...
1
vote
2answers
71 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
105 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
21 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
39 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
51 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 ...
0
votes
1answer
15 views

Block background color not appearing on site

I added custom colors to my functions.php file: functions.php add_theme_support( 'editor-color-palette', array( array( 'name' => __( 'Blue'), 'slug' => 'blue', '...
3
votes
3answers
193 views

Possible to use @wordpress/create-block with multiple blocks?

Is it possible to change the file set-up of @wordpress/create-block to work with multiple blocks? I've been trying to tweak the files, but maybe it's not even possible. I can't find anything saying it ...
1
vote
0answers
52 views

How to add a link in a translation in gutenberg

I've created a block and in the sidebar I've some instructions with a link. But it gets escaped. The (relevant) code: import {__, sprintf} from '@wordpress/i18n'; const documentation_url = '...
0
votes
1answer
41 views

Rerender core Templates with with ToggleControl but it doesnt recognize block type

Hey Guys I want to change my const TEMPLATE = [template] dynamically with the <InnerBlocks template={TEMPLATE} /> component. Based on a toggle I want to remove my 'core/image' block. I tried to ...
1
vote
2answers
52 views

How to know whether you are editing a page or a post?

I have different styles applied to pages (I hide the title for them) and posts (I don't want to hide the title here, but style the date of the post). I want to style them differently, which ist ...
0
votes
2answers
15 views

How to find out whether a plugin is used in pages or posts?

I need to find whether any element of the so many Gutenberg- or Elementor-elements have been used in posts or pages. Example: I want to deactivate an Elementor Addon Plugin, which creates accordeons ...
1
vote
0answers
21 views

How to disable alignments for block patterns?

I'm creating a block pattern with a cover block as a container and a nested group block with other heading and text blocks inside. I would like to disable the option to change the alignment for all ...

1
2 3 4 5
24