| Developer |
cloudcatch
dkjensen |
|---|---|
| Update Time | Feb. 23, 2026, 4:33 a.m. |
| Donation URL: | donation |
| PHP Version: | 6.6 + |
| WordPress Version: | 6.9 |
| Copyright: | GPL-2.0-or-later |
| Copyright URL: | Copyright Information |
/wp-content/plugins/light-modal-block directory, or install the plugin through the WordPress plugins screen directly.Each modal is given a unique ID, which can be found inside the inspector controls of the block settings. It will look something like: Mk6I8L4haJB
To open a modal:
window.lightModalBlocks.get('modal-id-here').showModal(true);
To close a modal:
window.lightModalBlocks.get('modal-id-here').closeModal();
Paste the following code in your child themes functions.php file or similar: /* * Prevents the light modal block from focusing on a specific element when it opens. * * @return void / add_action( 'wp_enqueue_scripts', function () { wp_add_inline_script( 'cloudcatch-light-modal-block-view-script', 'window.lmbFocusableElements = "";', 'before' ); } );
The class lmb-open is added to the <body> of the page when a modal is open. You can use the following CSS to prevent scrolling
.lmb-open {
overflow: hidden;
}
useModals() hook via leveraging getBlocksByName().lmb-open when a modal is currently open on the page