Accordion Blocks


Accordion Blocks is a simple plugin that adds a Gutenberg block for adding accordion drop-downs to your pages.

The accordions should blend seamlessly with your theme. However, you may want to add custom styles to your theme.


  • Adds a Gutenberg block for adding accordions to your site.
  • Supports multiple accordions with individual settings for each accordion item.
  • Fully responsive.
  • Support for item IDs and direct links.
  • Accessible (for users requiring tabbed keyboard navigation control).

Optional Features

  • Open individual accordion items by default.
  • Disable auto closing of accordion items.
  • Manually close items by clicking the title again.
  • Scroll page to title when it’s clicked open (including setting a scroll offset position).
  • Set the HTML heading tag for the title element (h1–h4, button).
  • Set defaults to be applied to all new accordion items or reset a specific accordion item to the defaults.
  • Supports adding custom block styles using wp.blocks.registerBlockStyle.


The plugin will ultimately output following HTML (simplified for this example):

<div class="wp-block-pb-accordion-item c-accordion__item js-accordion-item" data-initially-open="false" data-click-to-close="true" data-auto-close="true" data-scroll="false" data-scroll-offset="0">
    <h2 id="at-76840" class="c-accordion__title js-accordion-controller" tabindex="0" role="button" aria-controls="ac-76840" aria-expanded="false">
        Title with H2 tag
    <div id="ac-76840" class="c-accordion__content" style="display:none" aria-hidden="true">

Custom CSS

You can use the following CSS classes to customize the look of the accordion.

.c-accordion__item {} /* The accordion item container */ {} /* is-open is added to open accordion items */ {} /* is-read is added to accordion items that have been opened at least once */
.c-accordion__title {} /* An accordion item title */
.c-accordion__title--button {} /* An accordion item title that is using a `<button>` tag */
.c-accordion__title:hover {} /* To modify the style when hovering over an accordion item title */
.c-accordion__title:focus {} /* To modify the style when an accordion item title currently has broswer focus */
.c-accordion__content {} /* An accordion item content container */


  • Accordion block settings sidebar
  • Accordion block in the editor


이 플러그인은 1(을)를 제공합니다.

  • Accordion Blocks


  1. Upload the ‘accordion-blocks’ folder to the ‘/wp-content/plugins/’ directory.
  2. Activate the plugin through the Plugins menu in WordPress.
  3. Add the accordions to your content.


Can I change all my existing accordion items to the defaults?

No. It is not possible to change all your accordion item’s settings (within the same page or across multiple pages) to the defaults.

Although I would like to offer this feature, based on my research it would require a significant amount of development time that I am unable to devote to a free plugin. If you are a developer and would be interested in helping implement a feature like that, please let me know.

Why isn’t the JavaScript file loading on my site?

This is most likely caused by a poorly coded theme. This plugin makes use of the wp_footer() function to load the JavaScript file and it’s dependancy (jQuery). Check your theme to ensure that the wp_footer() function is being called right before the closing </body> tag in your theme’s footer.php file.


For bug reports or feature requests or if you’d like to contribute to the plugin you can check everything out on Github.


2020년 12월 3일
Thanks, it works great. Just a bit difficult to add content into the block, but that I think that has mostly to do with Gutenberg.
2020년 10월 27일
I put 11 accordions and it only shows 6, is that a limitation?
2020년 10월 15일
Thanks Phil, this is exactly what I was looking for but didn't even know it! An elegant solution to setting up accordion blocks without any cruft!
2020년 9월 16일
This plugin has everything you need: It's very lightweight; it's clean and beautiful; it's simple to use, yet it has enough options so it fits every need; it's translatable; and supports Gutenberg blocks. It only needs support for nested items, but not everybody needs this.
모든 22 평가 읽기

기여자 & 개발자

“Accordion Blocks”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.


“Accordion Blocks”(이)가 2(으)로 번역되었습니다. 기여해 주셔서 번역자님께 감사드립니다.

자국어로 “Accordion Blocks”(을)를 번역하십시오.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하십시오.



  • Fixed: Use sample content (instead of real content) to preview custom blocks styles in the editor.
  • Fixed: Bumped required version to WordPress 5.4.


  • Fixed: Resolved issue with PHP notice for not setting permission_callback in REST API.


  • Added: Support for WordPress 5.5
  • Fixed: no-js styles are now specific to the accordion item block


  • Fixed: When typing backspace on a button title, it would delete the entire accordion item instead of backspacing a character


  • Fixed: Accordion titles once again support bold and italic formats
  • Fixed: Translation should now be possible via WordPress translation site


  • Fixed: An issue where, on some sites, accordion content would not smoothly animate open, instead just appearing instantly after a short delay
  • Fixed: Duplicated accordion items now have unique IDs which should resolve the issue where clicking on the duplicate title opens the original block


  • New: An option to set default accordion item settings that will be applied to all newly created accordions. Individual accordion items can be reset to whatever is set as the defaults.
  • Fixed: Accordions not working if showing multiple posts’ content on one page. Unfortunately this will only apply to newly created accordions. Old accordions will need to be replaced to work properly.
  • Fixed: Users without the unfiltered_html permission (i.e. users with Author or lower user role) would get an “invalid content” error when viewing an accordion added by a user with the unfiltered_html permission (and vise-versa).


  • Fixed typo in plugin settings


  • Added minified versions of JS and CSS files


  • Made plugin translatable
  • Code cleanup


  • Added the ability to convert a paragraph or heading into an accordion.


  • Added the ability for the block in the editor to accept custom css classes (allows for custom registration of Block Styles)
  • Accessibility fix: Removed aria-hidden=false from closed accordions.


  • Updated readme.


  • All new plugin to support the new WordPress Gutenberg editor.