Lightweight Accordion


This extremely lightweight accordion plugin for WordPress allows you to add collapse elements to posts using a shortcode (via classic editor) or using Gutenberg. By using the details HTML tag and a few lines of CSS this allows for a javascript-free accordion for minimum page load.

Shortcode Usage examples

[lightweight-accordion title="My Accordion"]My Content[/lightweight-accordion]

Additionally you can display the accordion open on load with the accordion_open option.

[lightweight-accordion title="My Accordion" accordion_open=true]My Content[/lightweight-accordion]

You can also change the html tag wrapping the title of the accordion using the title_tag option.

[lightweight-accordion title="My Accordion" title_tag="h3"]My Content[/lightweight-accordion]

If you want to include FAQ schema you can add the schema option and set it to faq.

[lightweight-accordion title="What is your return policy?" schema="faq"]You have 1 week to return your items[/lightweight-accordion]

Shortcode Options

  • title (Required Default: null) The title of your accordion will be displayed at the top for users to click. A good example would be to include a user’s question so they could click it for more details.
  • content (Required Default: null) Content that will go into your accordion element.
  • title_tag (Default: “span”) This sets the html tag that wraps the title in the accordion summary. Useful if you want to make it a heading tag for SEO purposes.
  • accordion_open (Default: false) Set this to true if you want your accordion to be open by default.
  • title_text_color (Default: false) Set this to a hex value or CSS color to change the color of the accordion title text.
  • title_background (Default: false) Set this to a hex value or CSS color to change the color of the accordion title text.
  • schema (Default: false) Set this to faq if you’d like FAQ schema to be included.
  • class (Default: false) Used to add a custom class to the parent container of the accordion.

Additional Details

If you’d like to remove the “lightweight-accordion.css” from being enqueued on your site use the filter below. It’s recommend you style the accordion yourself if you use this filter.

add_filter('lightweight_accordion_include_frontend_stylesheet', '__return_false' );



This plugin provides 1 block.

  • Lightweight Accordion


To install this plugin:

  1. Download the plugin
  2. Upload the plugin to the wp-content/plugins directory,
  3. Go to “plugins” in your WordPress admin, then click activate.
  4. Add the shortcode where you want the accordion to appear. Likewise in Gutenberg you can find the “Lightweight Accordion” block under the “formatting” section in the block selector.


8 ਫਰਵਰੀ 2021
Excellent plugin and very useful alternative to accordion blocks that rely on jQuery. This is very lightweight, and other than IE 11 (almost 8 years old), browser support is good across the board. I love that there's an option to choose the HTML tag for the accordion title, as well as the option to include schema markup or not. The filter to remove the CSS file and roll your own is great too. Thank you, Andy. Great work and really appreciate you taking the time to put this together and maintain.
17 ਦਸੰਬਰ 2020
This widget is great! It really helped me with a FAQ page, it made making a useful dropdown lightweight and speedy!
11 ਸਤੰਬਰ 2020
one of the two spoiler/ expand-collaps plugins that does work even with Chameleon 3.9.12 from Elegant Themes + WordPress 5.5.1. The WP 5.5 update broke not only that theme's integrated show/hide shortcode functionality [learn_more caption="..] but also rendered all other such plugins I tried (which all might be based on jquery) non-functional. Lightweight Accordion works like a charm. Thank you Andy!
14 ਅਪ੍ਰੈਲ 2020
This has been a great new addition to my workflow on long-form articles that can offer a better user experience with collapsible accordion-style content to show/hide content. Previously, I was creating these accordions manually every time I wanted to insert one... and this plugin makes it doable in just a few clicks, while also still being super lightweight. Absolutely love it so far.
Read all 4 reviews

ਯੋਗਦਾਨੀ ਤੇ ਵਿਕਾਸਕਾਰ

“Lightweight Accordion” is open source software. The following people have contributed to this plugin.


“Lightweight Accordion” has been translated into 3 locales. Thank you to the translators for their contributions.

“Lightweight Accordion” ਦਾ ਆਪਣੀ ਭਾਸ਼ਾ ਵਿੱਚ ਅਨੁਵਾਦ ਕਰੋ।

ਵਿਕਾਸ ਕਾਰਜ ਵਿੱਚ ਰੁਚੀ ਰੱਖਦੇ ਹੋ?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.



  • New option for title and background color for the accordion tab (works with Gutenberg and shortcode).
  • New visual border to see what’s inside the accordion while using Gutenberg.
  • New ability to append a custom class to the main accordion div.
  • No longer runs content clean up processing (wpautop/preg_replace) to tab content when using Gutenberg.


  • CSS style compatibility fix for some themes.


  • Tested up to WordPress 5.6.
  • Bug fix in Gutenberg editor styles.


  • Added a slight opacity change animation when opening accordions.


  • Ability to add FAQ schema to a collapsible using the new ‘schema’ option in the shortcode or dropdown in the Gutenberg editor.
  • Bug fixes for PHP warnings.


  • Better Gutenberg editor styles to tell what is inside a collapsible.
  • Tested up to WordPress 5.5.


  • Bug fix: now runs wpautop() on the entire contents of the accordion (so the first paragraph won’t be missing a p tag now)


  • New filter to denqueue the lightweight accordion CSS from the frontend.

    add_filter(‘lightweight_accordion_include_frontend_stylesheet’, ‘__return_false’ );


  • Initial Release.