What are hooks and filters?
Hooks and filters are part of the WordPress plugin API that allows you to modify or add functionality to WordPress and plugins like Beaver Builder:- Actions (Hooks): Allow you to execute custom code at specific points during execution
- Filters: Allow you to modify data before it’s used or displayed
Common Beaver Builder filters
Here are some commonly used Beaver Builder filters:Customize module output
Modify the output of any module:Modify module settings
Filter module settings before they’re registered:Customize CSS and JavaScript
Control how CSS and JavaScript are loaded:Modify breakpoints
Customize responsive breakpoints:Common Beaver Builder actions
Here are some commonly used Beaver Builder actions:After layout render
Execute code after a layout is rendered:Before saving module
Run code before a module is saved:After module registered
Execute code after a module is registered:Useful filters
Disable notifications
Disable notifications from Beaver Builder in the UI:Customize keyboard shortcuts
Modify or add keyboard shortcuts:Modify template categories
Filter template categories:Finding available hooks
To find all available hooks and filters in Beaver Builder:- Search the Beaver Builder plugin files for
do_action()andapply_filters() - Review the Beaver Builder developer documentation
- Use a code reference plugin to discover hooks
- Check the Beaver Builder GitHub repository for examples
Best practices
- Always use unique function names to avoid conflicts
- Check if a function or class exists before using it
- Use appropriate priority values (default is 10)
- Document your hooks and filters for future reference
- Test thoroughly after adding custom hooks
- Use child themes or plugins, never modify core files
- Follow WordPress coding standards