Gutenberg – Remove add block button

You can register a template for your CPT and lock that template so users cannot add, move, or delete blocks. There are several ways to set up the template, but since your CPT is already registered, the easiest might be: <?php add_action( ‘init’, ‘wpse_360075_register_block_template’ ); function wpse_360075_register_block_template() { // Make sure to change “yourcptslug” to … Read more

How to use apiFetch to get author information in Gutenberg properly?

Finally, I found out how to do it. Just call fetchApi in componentDidMount and then create a new state in your component and add the response to this state when the request is done: constructor(props) { super(props); this.state = { data: {}, }; } componentDidMount() { apiFetch( { path: ‘/wp/v2/users/1’ } ) .then(data => this.setState({ … Read more

Not seeing text alignment option in Image block

Using the Align options you found (Align left, Align center, Align right) is often the easiest way to allow text to flow around your images in your WordPress posts. Add the Image Select Align right in Image options Add some text (puts Image in Paragraph block) Adjust the width of the Image block so the … Read more

How to add more default colors?

You should be able to add more colors using the add_theme_support function as per the docs here add_theme_support( ‘editor-color-palette’, array( array( ‘name’ => __( ‘strong magenta’, ‘themeLangDomain’ ), ‘slug’ => ‘strong-magenta’, ‘color’ => ‘#a156b4’, ), array( ‘name’ => __( ‘light grayish magenta’, ‘themeLangDomain’ ), ‘slug’ => ‘light-grayish-magenta’, ‘color’ => ‘#d0a5db’, ), array( ‘name’ => __( … Read more