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
32 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
51 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
30 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
2answers
254 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
114 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
27 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
174 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
96 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
339 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
39 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
45 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
72 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
21 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
467 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
48 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
54 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
20 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
34 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
vote
1answer
140 views

Custom WP Block using Inner Blocks crashes editor, doesn't save content

I've finally gotten around to building a custom Gutenberg/WP Block for a project and it's basically kicking my ass. Working with React, Node, WebPack, Gulp is all new enough to me so there's a ...
0
votes
2answers
91 views

Search for a keyword across post types in a Gutenberg component

In a Gutenberg component I'm developing, I have a function that searches for a keyword across multiple post types specified in a constant: const postTypes = [ 'posts', 'pages', 'portfolio' ]; const ...
1
vote
1answer
38 views

How insert negative values in Gutenberg box-control

i'm using box-control component to control the position (top, bottom, left, right) of an absolute positioned element. I have a problem: box-control doesn't allow negative values. How can i fix this or,...
1
vote
0answers
50 views

Gutenberg - Dispatch action or setAttributes() on Post Save/Update action instead of onChange listener

I have a requirement to add up to 8 user selected custom colors to the list of default options when using the Colour Palette. I have registered a meta that saves custom colours. Problem: I want to ...
1
vote
1answer
45 views

Dynamic Gutenburg block output echoes in WP Dashboard

I'm building a dynamic block in a custom plugin that shows code in my blog posts. I'm struggling with this bug where the output of the render_callback function gets echoed out to the WP dashboard when ...
0
votes
1answer
371 views

Using apiFetch for retrieving post data in Gutenberg

In a plugin I'm developing, I registered a custom REST API route to get some post data passing a post id: function rest_api_init() { register_rest_route( 'custombase/v1', '/post/(?P<id>[\d]+)...
2
votes
0answers
40 views

oEmbed in wordpress multisite not working

We've multisite on single wordpress installation. For example, Main site - testsite.com/ Sub site - testsite.com/subsite Now when I try to embed a blog from subsite into mainsite or vice verca or post ...
0
votes
1answer
69 views

Dequeue Gutenburg Block Library CSS ('wp-block-library') in Admin

I am working on removing the default Gutenberg block library stylesheet and replacing it with custom pared-down styles. I do not want the original stylesheet to load on either the front or back end, ...
3
votes
1answer
63 views

getEntityRecord without knowing the post type

In Gutenberg there's the getEntityRecord selector that allows you to get the data of a post of a specific post type: // get the post object of a page with post id = 42 const post = useSelect( ( select ...
2
votes
1answer
118 views

What's the recommended Gutenberg component for adding a URL, in the toolbar/sidebar?

I have a custom block that needs a URL attribute. I figured it made sense to set the URL in the sidebar or the toolbar, but I can't find a way to do it. I've tried: LinkControl Still experimental, and ...
0
votes
1answer
41 views

How to keep the capability of users and disable Gutenberg editor in WordPress?

I disabled Gutenberg web builder/ editor using the following code: add_filter( 'use_block_editor_for_post', '__return_false' ); Somehow this impacted contributor's capability to submit post for ...
1
vote
1answer
53 views

How to update a meta field of type array in Gutenberg

In a plugin I'm building for Gutenberg, I register a meta field named _related_posts, which stores an array of post ids: PHP: function register_meta_fields() { register_post_meta( '', '...
0
votes
1answer
99 views

useSelect second parameter

I use the useSelect hook to retrieve data from the database when developing for the block editor. Browsing the Gutenberg code, I see that in addition to the function parameter, useSelect has an ...
0
votes
0answers
29 views

Making custom meta box required (with error message if not filled in) on Gutenberg

<input required name="myName" type="text" value="<?php echo $myValue; ?>" class="regular-text"> Does not produce an error message if the field is ...
0
votes
1answer
38 views

Weird failing request

Below there is a simplified version of the concept I'm trying to make work. In a post, I'm manually inserting this core Image block: <!-- wp:image {"id":7} --> <figure class="...
0
votes
0answers
22 views

Style Gutenberg Editor based on Post Type or Page Template

On our website we have sections that have different backgrounds that span the full width of the viewport and for this reason we have introduced a custom block called section with its own inner ...
1
vote
1answer
132 views

Can the index.asset.php file be used with the enqueue_block_editor_assets action?

I'm developing a plugin that registers a PluginDocumentSettingPanel in Gutenberg. As this is not a block, I cannot use the register_block_type function to add its assets, so I have to employ the ...
0
votes
2answers
626 views

"Cannot use import statement outside a module" JS error while adding a custom meta block?

I am following the "Store Post Meta with a Block" guide from the official Block Editor Handbook to add a custom post meta block using the supplied sample code (below). However, the block ...
1
vote
0answers
16 views

Do I need wp-tinymce-js?

WordPress block editor is very slow. Gutenberg is loading a lot of javascript files. In my case 83 .js files. One of the largest sized file is wp-tinymce-js. I want to dequeue it. Do I still need it ...
0
votes
0answers
24 views

AJAX Saving a meta post does not work in Gutenberg using my save post button

I've created a meta box with posts and would like to save it by clicking the submit button. Saving with Ajax works well in the classic editor and stops working as soon as it moves to Gutenberg. Would ...
0
votes
0answers
53 views

Possible way of having multiple Gutenberg instances for a page?

I'm trying to create a system in which the Admin of the wordpress site can create different "versions" of a same page depending on the custom user roles we create for certain users. There's ...
1
vote
0answers
29 views

Possible to add a meta field for css attribute to the editor Advanced panel?

I'm working on a child theme based on Foundation. While I can keep editing custom HTML for things like Foundation's built-in accordions, it would be nice if the block editor "Advanced" panel ...
0
votes
0answers
28 views

Editing HTML structure of Gutenberg layout recent post?

I used gutenberg layout method with wordpress editor to call recent posts. Wordpress automatically generated this HTML structure. <ul class="wp-block-latest-posts__list has-dates wp-block-...
2
votes
1answer
198 views

Gutenberg. How To Register A Custom Block Style For Specific Post Type Only

For the core/paragraph-Block, I would like to register a custom style. This is working fine with const { registerBlockStyle } = wp.blocks; wp.domReady( () => { registerBlockStyle( 'core/...
0
votes
0answers
34 views

Gutenberg Components no displaying in Edit

I have an issue with the edit function in this Gutenberg block. If I add another component InspectorControl in the edit function my googlemap that is supposed to be rendered in the map div does not ...
3
votes
0answers
53 views

What's the absolute minimum code that I need to create a dynamic block?

I'm making a test case for a dynamic block; what's the absolute minimum code that I need to register a block? (so I don't need to run create-block (granted it takes only takes 5 minutes for me to run, ...
0
votes
1answer
48 views

Get terms of a taxonomy using useSelect

I'm developing a Gutenberg block and I need to show a dropdown with all the terms of a custom taxonomy in it. I'm using the useSelect hook for retrieving this data, but it's not working because it ...
0
votes
1answer
67 views

Remove or rename "Default" from Gutenberg typography settings

I've added my own font sizes to the theme I'm working on, but the value "Default" persists in the dropdown. With the name scheme needed for this particular site I cannot just reformat "...
0
votes
1answer
95 views

parsing nested blocks (in columns, etc) via PHP

I'm checking posts for a custom block and trying to render the content of those blocks elsewhere in the site via PHP. My method for doing that looks like this: if ( has_block( 'custom/block' ) ) ...
0
votes
0answers
29 views

Customizing the wp_video_shortcode output with add_filter

I am trying to add onmouseover="this.play()" onmouseout="this.pause()" to the default <video element in Wordpress. I am using Gutenberg block editor. By default, this is what ...
2
votes
0answers
18 views

Can I share predefined fonts from theme_support with a gutenberg component?

I have a few fonts defined in my functions.php: add_theme_support('editor-font-sizes', array( array( 'name' => esc_attr__('Small', 'moderna'), '...

1 2
3
4 5
25