Common Beaver Builder filter examples
There is a comprehensive Hook & Filter Reference but here's a list of some commonly used filters and their potential uses. This article is aimed at developers and assumes that you know where to put the code and how to tweak it
#
BB filter in WP admin listsIn WP admin lists of pages, posts, you can click a Beaver Builder link that shows only the items that have Beaver Builder layouts. The link is shown in this screenshot.
If you'd like to disable that feature altogether, use the filter fl_builder_admin_edit_sort_bb_enabled
.
#
Example:#
Remember settings tab usedThe Beaver Builder editor remembers the last tab used in the row/column/module settings window. If you want to disable that and have the row, column, or module settings window always open at the first tab, use the filter fl_remember_settings_tabs_enabled
.
#
Example:#
Prevent modules from loading site-wideBy default, when you disable modules in Settings > Beaver Builder > Modules, they do not appear in the module list in the Beaver Builder editor, but any modules of that type already used in layouts are still displayed on web pages.
You can change the behavior in Settings > Beaver Builder > Modules so that when you disable modules they don't load or render in either the front end or the editor, and before you disable them you'll be able to see how many modules of that type are already in use. This is done by setting the is_module_disable_enabled
filter to true
. Add the following line of code to the functions.php file in your child them
After you've added this filter, you'll see module counts displayed at Settings > Beaver Builder > Modules so you can see if there are existing modules that will be blocked from loading and rendering, as shown in the following screenshot.
It shows how many times each module is used in pages, posts, and "Templates." The "Templates" category applies both to saved layout templates and to saved rows, columns, and modules.
When you clear a checkbox to disable a module, it will not appear for selection in the Beaver Builder editor and any existing modules of that type will not load or render on the page.
#
Disable inline editingYou can completely disable inline editing by using the fl_inline_editing_enabled
filter.
#
Example:#
Disable notifications from Beaver Builder in the UIThere's a bell icon in the Beaver Builder editor UI that, when clicked, shows notifications that are issued by Beaver Builder. You can disable the notifications with the filter fl_disable_notifications
#
Example:fl_ajax_*
#
Use this filter to filter the results of the builder’s front-end AJAX actions. For example, for save_settings the filter would be fl_ajax_save_settings
.
See the classes/class-fl-builder-ajax.php file for a complete list of core AJAX actions that can be appended to the flajax* filter.
fl_builder_admin_settings_post_types
#
Use this filter to modify the post types that are shown in the admin settings for enabling and disabling post types.
fl_builder_column_custom_class
#
Use this filter to work with the custom class a user adds to a column under Column Settings > Advanced > Class.
fl_builder_get_cache_dir
#
Use this filter to modify the cache directory path and URL that the builder uses to store cached images, JavaScript, and CSS files.
fl_builder_get_upload_dir
#
Use this filter to modify the upload directory path and URL that the builder uses to store things like the cache and custom icons.
fl_builder_global_posts
#
Use this filter to specify a post or posts whose CSS and JavaScript assets should be loaded globally. This is useful when you want to display a builder layout on every page of your site such as in a sidebar. This filter is passed in an array to which you can add post IDs that should be loaded globally.
fl_builder_layout_style_dependencies
#
Use this filter to add dependencies to the dependency array when the main builder layout CSS file is enqueued using wp_enqueue_style()
.
fl_builder_mailchimp_double_option
#
Use this filter to enable double opt-ins for MailChimp integrations. Returning true
enables double opt-ins; returning false
enables single opt-ins. The default return value for this filter is false.
fl_builder_module_categories
#
Use this filter to add custom module categories that will show up before the default module categories in the builder’s UI. Note these categories only show if they contain modules.
fl_builder_module_custom_class
#
Use this filter to work with the custom class a user adds to a module in the Class field on the Advanced tab.
fl_builder_post_types
#
Use this filter to modify the post types that the builder works with.
fl_builder_register_module
#
Use this filter to override the modules that are enabled in the builder.
fl_builder_register_settings_form
#
Use this filter to modify the config array for a settings form when it is registered.
fl_builder_render_css
#
Use this filter to modify the CSS that is compiled and cached for each builder layout.
fl_builder_render_js
#
Use this filter to modify the JavaScript that is compiled and cached for each builder layout.
fl_builder_render_settings_field
#
Use this filter to modify the config array for a field before it is rendered.
fl_builder_render_shortcodes
#
Use this filter to prevent the builder from rendering shortcodes. It is useful if you don’t want shortcodes rendering while the builder UI is active.
fl_builder_row_custom_class
#
Use this filter to work with the custom class a user adds to a row under Row Settings > Advanced > Class.
fl_builder_settings_form_defaults
#
Use this filter to change the defaults for any of the settings forms in the builder including global, row, column and module settings.
fl_builder_upgrade_url
#
Use this filter to modify the upgrade URL in Beaver Builder Lite. This can be used to add an affiliate ID.