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
21 views

Design idea for custom post type with sections

Intro: This is my first time working with wordpress, that's I why I would love to get some inspiration from other wordpress developers on this topic. Probably I'm overlooking an obvious solution. I'm ...
0
votes
0answers
12 views

When setting styles to an extended block that was saved as a pattern, it doesn't remove the style that was there

I'm extending the button block, adding extra options such adding theme colors (a color picker) and icons (radio group). This adds class names for each of the options. has-icon, has-icon-{icon}, is-...
0
votes
1answer
11 views

Why is an argument of onChange nested in <p>...</p> in Gutenberg custom block RichText?

When editing a RichText on an admin panel, onChange's argument is nested in a paragraph tag like <p>my input</p>. However, I have not specified p tag anywhere in my source code. Even when ...
1
vote
1answer
34 views

Register JS for block on frontend only

I'm using the following in PHP to register my custom block: register_block_type( __DIR__, /* block.json */ array( 'render_callback' => 'render_my_block', 'script' => 'my-custom-js', )...
0
votes
0answers
14 views

Gutenberg: FontSizePicker crashes Editor "Cannot destructure property 'frameElement' of 'r' as it is null."

I added my block to an article and the new full site editing. When I try to edit the fontsize in Gutenberg with the FontSizePicker Component the editor crashes with "Cannot destructure property '...
0
votes
1answer
28 views

Looping over wordpress meta to create `<TextControl>` 's?

I'm looking for an intelligent way to iterate over available post meta, preferably by using the prefix _postcode_pricing_, and create new <TextControl> components for each. Really, I have two ...
1
vote
1answer
30 views

Editor API Endpoint or Data Store That Provides a List of Meta Fields for Post Types

I'm building a custom block that allows an editor to choose a Meta Key from a dropdown menu: However, I am unable to find a data store or API endpoint available (out of the box) that will provide a ...
0
votes
0answers
30 views

wordpress full site editing problem when extending core blocks

Hi i am extending the heading block using the filter hooks functions. so i am using the "blocks.registerBlockType" to add additional attributes. i am using the "editor.BlockEdit" ...
-1
votes
1answer
26 views

WordPress npm run build and start only outputs wp-scripts start but does nothing

I made a WordPress plugin with 3 blocks. The package.json looks like this: "scripts": { "build": "wp-scripts build", "format": "wp-scripts ...
0
votes
1answer
10 views

Gutenberg getBlockIndex in save() function

In my block's edit() function i'm getting the index of each inner block: // a block used in innerblocks edit( { attributes, setAttributes, clientId } ) { let blockIndex = wp.data.select( 'core/...
0
votes
1answer
47 views

Why does the custom HTML block not preserve the HTML characters?

For example it seems that the plain single-quote character ' (&#x27;) is converted to the right ones ’ (&#8217;) in the HTML page output. I understand the reason for this in regular Gutenberg ...
0
votes
1answer
31 views

Gutenberg Blocks - Cannot retrieve block saved attributes in edit post

After registering a new block in Gutenberg editor, it works fine until save /publish post, the output is fine in front end too, but after refreshing the edit screen, block shows the block validation ...
0
votes
0answers
22 views

Print custom field in Query Loop block

I have added a custom field with the Advanced Custom Fields plugin. I can print the content of the field on the post itself using the acf shortcode ([acf field="date"]) without issues. ...
0
votes
1answer
26 views

Gutenberg Blocks: how to determine an index of the current inner block?

I'm trying to implement a bootstrap5 carousel component as a Gutenberg block. It all appears to be working as intended, except for adding the "active" class to a first element. I tried to ...
0
votes
0answers
14 views

Problem width wp_insert_post_data and Gutenberg block editor

I need to change the post title of a Custom Post Type before save it. I have try with wp_insert_post_data filter and works fine. The problem is that normal posts that uses Gutenberg fires an error &...
0
votes
0answers
22 views

Detect if a block has been deleted

I’m currently working on a slider block for the block editor. While I use custom buttons to add a slide (which is a block), I can detect when a new block has been added to tell the slider script to ...
0
votes
1answer
28 views

How to upload and style svg logo?

WP beginner here. I'm trying to upload an svg logo to my site. The logo can be accessed here. If you open it in the browser and inspect it, it should show the svg tags around the object. I've ...
0
votes
0answers
26 views

Gutenberg editor auto remove wrapping tags like <u>

THE PROBLEM: When pasting content from a source external to Gutenberg into Gutenberg some times we have something like this <p>CLASSIC TEXT <u>underline text</u> CLASSIC TEXT</p&...
1
vote
0answers
23 views

Gutenberg InnerBlocks predefined block supports

I am using a template for InnerBlocks and adding predefined attributes like heading level and paragraph placeholder: const MY_TEMPLATE = [ [ 'core/image', {} ], [ 'core/heading', { level: 3 } ]...
0
votes
1answer
26 views

Invalid hook call on save, not edit when using swiper slider

I have installed swiper slider (react version) and created a custom block. When I add the block in the backend it works swimmingly and I can swipe just fine. But when I save and view in the frontend ...
0
votes
0answers
15 views

Keyboard shortcut to format text as superscript or subscript

Is there any way to add a shortcut to the WordPress Gutenberg editor, so that I can format selected text or current caret position as superscript or subscript.
0
votes
1answer
20 views

If you have multiple dynamic blocks with a post loop on a page, how do you avoid duplicates from inside the render_callback function?

I'm building dynamic blocks to customize the blog index into more of a magazine style layout, featured posts, categories, other content, all mixed together. My dynamic blocks are able to render a loop ...
0
votes
0answers
15 views

Setting fontSize within core/heading

Trying to specify a default font size. Using my markup below, typography is ignored and therefore fontSize is also ignored. Is there no way of specifying these parameters as default on an innerblock? &...
0
votes
0answers
21 views

Is there a function to "blockify" html?

Let's say we have a string that contains <h1>Here's a title</h1> <p>Here's some text</p> I'm looking for a function that parses this to whatever a block looks like (written ...
0
votes
1answer
29 views

Widgets and Post/Page edit/new blank, console errors only, no server errors

My post edit, post create, page edit, page create are completely blank pages (no WordPress navigation bar, no top admin bar). My widget page has the top admin bar and side navigation, but the rest of ...
1
vote
0answers
30 views

Cannot find a list of data selectors for Gutenberg editor

I've been searching through WordPress docs and internet but I can't find a list of available data stores for Gutenberg editor. Example data store in use: wp.data.select('core/block-editor'); I know a ...
0
votes
0answers
81 views

Pass custom props to <InnerBlocks.Content />

I have a parent component and want to pass some custom props down to the child. The below is my save function. I want to pass the number of columns the user chose in the parent component and pass that ...
0
votes
1answer
19 views

Gutenberg button removed on save if its empty

I have buttons with no text in my design which has icons designed in :before of the a tag. It was working fine with the WP 5.5, but now I have updated in live and when I save any page it removes all ...
1
vote
0answers
46 views

Programatically update posts in database from one block to another using transform

Scenario: I've made a plugin which is similar to or compatible with another solution. On activation of this new plugin, I'd like to start migration of all the existing content in the pages over to the ...
1
vote
0answers
34 views

How to access noticeOperations from withNotices

In my edit.js file I want to access noticeOperations which I thought I could do via props but if I console.log props it isn't there. import { withNotices, } from "@wordpress/components"; ...
0
votes
1answer
50 views

Proper way to use useSelect

I am using useSelect to get available image sizes and then I want to check that the images actually have these sizes as there may have been some custom image sizes added. What I have done is working ...
2
votes
1answer
36 views

Gutenberg LinkControl suggestionsQuery not working

I have a link control like so: import { __ } from "@wordpress/i18n"; import { __experimentalLinkControl as LinkControl, } from "@wordpress/block-editor"; import "./editor....
1
vote
1answer
26 views

Are block templates incompatible with serialize_blocks?

I need to dynamically create posts from arbitrary content using wp_insert_post() and wp_update_post(). The post type I'm working with has a simple block template associated with it, so my goal is to ...
0
votes
0answers
16 views

Auto focus RichText field

I have a <RichText/> field that I can append more to at the click of a button. But when I click the button and the new RichText field appears, I would like it to be focused so that you can just ...
1
vote
1answer
44 views

How to set Gutenberg preferences programmatically with wp.data.dispatch?

The Gutenberg Options > Preferences menu contains a number of additional settings to customise the Gutenberg experience. The default GUI is shown below. I would like to programmatically enable the ...
0
votes
3answers
39 views

How to add custom HTML tags in the visual mode via keyboard only?

Let say I want to insert different inline formatting texts. I can do that by opening the HTML mode, but is there a way to do it directly in the visual mode? For example, if I type span.a in a ...
0
votes
0answers
24 views

What is the recommended / best way to do this: Event calendar post/type in a block-based theme?

my question is this: assume I have a php-themed WordPress site with an event calendar page template that's using post type "event", which in turn has a lot of custom fields that hold the ...
0
votes
0answers
71 views

Can't add front end script file using block.json for a custom block

I've used @wordpress/create-block to create a block in a plugin. I can edit, save, view blocks in the editor from all the files created, but when I try to add a script that will show on the front end, ...
1
vote
0answers
24 views

Cleaning up after block dismount

I would like to do some actions when block is deleted from editor. I currently use this code: // cleanup of meta data from post, note that return value is cleanup function useEffect(() => ()...
1
vote
0answers
22 views

Auto synchronize saving of custom block editor entities

I added a custom entity to block editor, it serves a purpose to save some data to custom-made table in database: dispatch('core').addEntities([{ label: 'kalendar', name: 'events_meta', ...
0
votes
0answers
23 views

Add a Page Screen is Visually Blank

On one of my sites on a multisite install of wordpress I am having an issue where when I try to add or edit a page just a blank page loads. The HTML of the page that should be there is present if you ...
0
votes
1answer
34 views

Unable to edit server side rendered block

I have a problem with Gutenberg block. I created block which pulls recent custom post type posts and display them as carousel. I struggled with saving that block but I found info that I should use ...
0
votes
1answer
24 views

Enable Gutenberg for Woocommerce

Via a php snippet I have enabled Gutenberg for Woocommerce. Works perfect but sometimes when I want edit product, I get a white screen on some product pages. Any idea how this happen? (Could be a JS ...
0
votes
0answers
31 views

How to populate a Gutenberg select field SelectControl with option value from PHP array

For a gutenberg block, I need a select with a PHP array as options values. I'm not sure where to go. This array come from a CSV file To get array from this CSV i use this PHP code : /* Source File URL ...
0
votes
1answer
48 views

Trying to turn the Edit function into a class to be able to use React lifecycle methods

In order to be able to use React lifecycle methods I'm trying to change the default Edit function created by @wordpress/create-block into a javascript class like in this simple test example: import { ...
0
votes
1answer
40 views

Gutenberg build error: You may need an appropriate loader to handle this file type SCSS

I had a plugin up and running with a scss to css compiler. Suddenly after I moved a few files into a better structure I get this error while building the block: ERROR in ./blocks/random-game/src/style....
0
votes
0answers
29 views

Gutenberg Blocks and get_option() for styling

I'm creating a Gutenberg block and I'm trying to customize a button's style (background color, text color, etc.) and it's inner text with hexcode set in an options menu. What's the best way to access ...
1
vote
0answers
11 views

Is it possible to access the wp-admin from one instance while keeping WP_HOME pointing to the balancing url?

I have a Wordpress running in a load balancer scheme with two instances. For security reasons, i've decided to block wp admin access from the public url and allowing it from one of the instances. ...
1
vote
1answer
30 views

Correctly handling WordPress core data retrieval in Gutenberg

I'm attempting to get the ID for either a tag / category by slug name within a Gutenberg sidebar plugin. I created the below function, but am still struggling with the results coming back null the ...
0
votes
1answer
33 views

How to add InnerBlock multiple times in the same block

When I click a button to add a new tab, I would like to have an <InnerBlock /> so I can add other blocks within the tab. Trying this does not work as the same seems to be in all the dynamically ...

1
2 3 4 5
27