Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
WordPress: Add aligncenter to Gutenberg groups block

Per default, the Gutenberg groups block has only two alignment options: wide and full width.

I now want to add a custom alignment center to the block. Other blocks like images have this option.

Is there any way to extend a core block like this?

I know that there is an option for custom styles with registerBlockStyle (See docs).

But is there also something like this for basic controls/settings? I couldn't find anything in the docs.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I found an answer here.

It works, if I change the code like this:

wp.hooks.addFilter( 'blocks.registerBlockType',
  'my/change_alignment', ( settings, name ) => {

  switch( name ) {
    case 'core/group':
    case 'core/cover':
      return lodash.assign( {}, settings, {
        supports: lodash.assign( {}, settings.supports, {
          align: [ 'center', 'wide', 'full']
        } ),
      } );
  }

  return settings;
});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!