: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// has false publicly_queryable setting
if ( $post_id && $post_type && is_user_logged_in() && $is_unqueryable ) {
$args['et_post_id'] = $post_id;
$args['et_post_id_nonce'] = wp_create_nonce( 'et_post_id_' . $post_id );
$args['et_post_type'] = $post_type;
$args['et_post_type_nonce'] = wp_create_nonce( 'et_post_type_' . $post_type );
return add_query_arg( $args, et_fb_prepare_ssl_link( $url ? $url : get_the_permalink() ) );
* @param string $url Post url.
if ( ! function_exists( 'et_fb_get_vb_url' ) ) :
function et_fb_get_vb_url( $url = false ) {
return et_fb_get_builder_url( $url );
* @param string $url Post url.
if ( ! function_exists( 'et_fb_get_bfb_url' ) ) :
function et_fb_get_bfb_url( $url = false, $is_new_page = false, $custom_page_id = false ) {
return et_fb_get_builder_url( $url, 'bfb', $is_new_page, $custom_page_id );
* Filterable options for backend and visual builder. Designed to be filtered
* by theme/plugin since builder is shared accross Divi, Extra, and Divi Builder
* @return array builder options values
if ( ! function_exists( 'et_builder_options' ) ) :
function et_builder_options() {
return apply_filters( 'et_builder_options', array(
'all_buttons_icon' => 'yes', // Default appearance of button icon
* Get specific builder option (fetched from et_builder_options())
* @param string option name
* @return mixed builder option value
if ( ! function_exists( 'et_builder_option' ) ) :
function et_builder_option( $name ) {
$options = et_builder_options();
$option = isset( $options[ $name ] ) ? $options[ $name ] : false;
return apply_filters( "et_builder_option_{$name}", $option );
* Pass thru semantical previously escaped acknowledgement
* @deprecated {@see et_core_esc_previously()}
* @since 3.17.1 Deprecated
* @param string value being passed through
function et_esc_previously( $passthru ) {
et_debug( "You're Doing It Wrong! Attempted to call " . __FUNCTION__ . "(), use et_core_esc_previously() instead." );
* Pass thru semantical escaped by WordPress core acknowledgement
* @deprecated {@see et_core_esc_wp()}
* @since 3.17.1 Deprecated
* @param string value being passed through
function et_esc_wp( $passthru ) {
et_debug( "You're Doing It Wrong! Attempted to call " . __FUNCTION__ . "(), use et_core_esc_wp() instead." );
* Pass thru semantical intentionally unescaped acknowledgement
* @deprecated {@see et_core_intentionally_unescaped()}
* @since 3.17.1 Deprecated
* @param string value being passed through
* @param string excuse the value is allowed to be unescaped
function et_intentionally_unescaped( $passthru, $excuse ) {
et_debug( "You're Doing It Wrong! Attempted to call " . __FUNCTION__ . "(), use et_core_intentionally_unescaped() instead." );
// Add valid excuses as they arise
if ( ! in_array( $excuse, $valid_excuses ) ) {
et_debug( "You're Doing It Wrong! This is not a valid excuse to not escape the passed value." );
* Sanitize value depending on user capability
* @deprecated {@see et_core_sanitize_value_by_cap()}
* @since 3.17.1 Deprecated
* @return string value being passed through
function et_sanitize_value_by_cap( $passthru, $sanitize_function = 'et_sanitize_html_input_text', $cap = 'unfiltered_html' ) {
et_debug( "You're Doing It Wrong! Attempted to call " . __FUNCTION__ . "(), use et_core_sanitize_value_by_cap() instead." );
if ( ! current_user_can( $cap ) ) {
$passthru = $sanitize_function( $passthru );
* Pass thru semantical intentionally unsanitized acknowledgement
* @deprecated {@see et_core_intentinally_unsanitized()}
* @since 3.17.1 Deprecated
* @param string value being passed through
* @param string excuse the value is allowed to be unsanitized
function et_intentionally_unsanitized( $passthru, $excuse ) {
et_debug( "You're Doing It Wrong! Attempted to call " . __FUNCTION__ . "(), use et_core_intentionally_unsanitized() instead." );
// Add valid excuses as they arise
$valid_excuses = array();
if ( ! in_array( $excuse, $valid_excuses ) ) {
et_debug( "You're Doing It Wrong! This is not a valid excuse to not sanitize the passed value." );
* Prevent delimiter-separated string from having duplicate item
* @param string delimiter-separated string
* @param string delimiter
* @return string filtered delimiter-separated string
function et_prevent_duplicate_item( $stringList, $delimiter ) {
$list = explode( $delimiter, $stringList );
return implode( $delimiter, array_unique( $list ) );
* Determining whether unminified scripts should be loaded or not.
function et_load_unminified_scripts() {
static $should_load = null;
if ( null === $should_load ) {
$is_script_debug = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
$should_load = apply_filters( 'et_load_unminified_scripts', $is_script_debug );
* Determining whether unminified styles should be loaded or not
function et_load_unminified_styles() {
static $should_load = null;
if ( null === $should_load ) {
$is_script_debug = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
$should_load = apply_filters( 'et_load_unminified_styles', $is_script_debug );
* Enable / Disable classic editor based on saved option in Theme Options page.
* Only applies to versions of WordPress that have the Gutenberg editor.
function et_builder_enable_classic_editor( $enable ) {
if ( 'on' === et_get_option( 'et_enable_classic_editor', 'off' ) ) {
if ( version_compare( $GLOBALS['wp_version'], '5.0-beta', '>=' ) ) {
add_filter( 'et_builder_enable_classic_editor', 'et_builder_enable_classic_editor' );
* Check whether the BFB is enabled.
function et_builder_bfb_enabled() {
return apply_filters( 'et_builder_bfb_enabled', false );
* Check whether BFB is activated for this site or not.
function et_builder_bfb_activated() {
$bfb_settings = get_option( 'et_bfb_settings' );
$enabled = isset( $bfb_settings['enable_bfb'] ) && 'on' === $bfb_settings['enable_bfb'];
* Check whether the VB is loaded through TB.
function et_builder_tb_enabled() {
// Layout Block uses abstracted visual builder on modal originally introduced in TB. However,
// TB needs different Divi capability, hence adjust it for Layout Block Builder
$is_layout_block = ET_GB_Block_Layout::is_layout_block_preview();
$builder_capability = $is_layout_block ? 'use_visual_builder' : 'theme_builder';
return et_core_is_fb_enabled() && et_pb_is_allowed( $builder_capability ) && isset( $_GET['et_tb'] ) && '1' === $_GET['et_tb'];
* Check if the current screen is the Theme Builder administration screen.
function et_builder_is_tb_admin_screen() {
return is_admin() && 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'et_theme_builder' === $_GET['page'];
if ( ! function_exists( 'et_builder_filter_bfb_enabled') ):
* Theme implementation for BFB enabled check.
function et_builder_filter_bfb_enabled() {
$enabled = et_builder_bfb_activated();
if ( is_admin() && ! in_array( $pagenow, array( 'post.php', 'post-new.php', 'admin-ajax.php' ) ) ) {
} else if ( ! is_admin() && ! isset( $_GET['et_bfb'] ) ) {
} else if ( ! et_pb_is_allowed( 'use_visual_builder' ) ) {
if ( ! function_exists( 'et_builder_is_fresh_install') ):
* Get whether the builder is freshly installed.
function et_builder_is_fresh_install() {
return apply_filters( 'et_builder_is_fresh_install', false );
if ( ! function_exists( 'et_builder_filter_is_fresh_install') ):
* Theme implementation for fresh install check.
function et_builder_filter_is_fresh_install() {
return false === et_get_option( $shortname . '_logo' );
* Determine whether current request is AJAX request for loading BB data
* @todo remove & replace this function with `et_builder_is_loading_data()` once PR #6325 is merged
function et_builder_is_loading_bb_data() {
return isset( $_POST['action'] ) && in_array( $_POST['action'], array( 'et_pb_get_backbone_templates', 'et_pb_get_backbone_template' ) ); // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
* Determine whether current request is classic builder (BB) edit page
function et_builder_is_bb_page() {
// BB Is definitely on backend
// BB page is on either post new or edit post page in backend
if ( ! in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) {
// If BFB is activated, this is definitely not BB page
if ( et_builder_bfb_enabled() ) {
// Check if current post type has builder activated
if ( 'post-new.php' === $pagenow ) {
$post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : 'post';
$post_id = isset( $_GET['post'] ) ? $_GET['post'] : false;
$post_type = get_post_type( $post_id );
return et_builder_enabled_for_post_type( $post_type );
if ( ! function_exists( 'et_builder_toggle_bfb') ):
function et_builder_toggle_bfb( $enable ) {
do_action( 'et_builder_toggle_bfb', $enable );
if ( ! function_exists( 'et_builder_action_toggle_bfb') ):
* Theme implementation for BFB toggle.
function et_builder_action_toggle_bfb( $enable ) {
$bfb_value = $enable ? 'on' : 'off';
et_update_option( '', $bfb_value, true, 'et_bfb_settings', 'enable_bfb' );
if ( ! function_exists( 'et_builder_show_bfb_welcome_modal' ) ) :
* Show the BFB welcome modal.
function et_builder_show_bfb_welcome_modal() {
// Cancel if BFB is not enabled yet
if ( ! et_builder_bfb_enabled() ) {
// Cancel if current request is not editing screen
if ( ! in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) {
// Cancel if current edit screen use Gutenberg. `use_block_editor_for_post_type()` was added
// after v5.0 so check for its existance first in case current WP version is below 5.0
if ( function_exists( 'use_block_editor_for_post_type' ) && use_block_editor_for_post_type( get_post_type() ) ) {
// Cancel if current edit screen doesn't use builder
if ( ! et_pb_is_pagebuilder_used() ) {
// Cancel if assigned transient doesn't exist
if ( ! get_transient( 'et_builder_show_bfb_welcome_modal' ) ) {
// Clear Builder assets cache to avoid double reloading of BFB after theme update.
et_fb_delete_builder_assets();
// Clear Builder assets cache to avoid double reloading of BFB after theme update.
et_fb_delete_builder_assets();
delete_transient( 'et_builder_show_bfb_welcome_modal' );
<div class="et-core-modal-overlay et-builder-bfb-welcome-modal" style="z-index: 9999999999;">
<div class="et-core-modal">
<div class="et-core-modal-header">
<h3 class="et-core-modal-title"><?php esc_html_e( 'Welcome To The New Builder', 'et_builder' ); ?></h3>
<div class="et-core-modal-content">
<p><?php esc_html_e( 'You are now using the latest Divi Builder experience! This new version of the builder comes with many interface enhancements that were previously only available in the Visual Builder. It also improves performance and takes advantage of the latest builder technology. You can still switch back to the Classic Builder in your Divi Theme Options, however, we recommend familiarizing yourself with the new version and everything it has to offer.', 'et_builder' ); ?></p>
<p><a href="https://www.elegantthemes.com/blog/theme-releases/introducing-the-new-divi-builder-experience" target="_blank"><?php esc_html_e( 'Learn more about the new experience here.', 'et_builder' ); ?></a></p>
<div class="et_pb_prompt_buttons">
<a href="#" class="et-core-modal-action" data-et-core-modal="close"><?php esc_html_e( 'Start Building', 'et_builder' ); ?></a>
jQuery(document).ready(function() {
etCore.modalOpen(jQuery('.et-builder-bfb-welcome-modal:first'));
add_action( 'admin_footer', 'et_builder_show_bfb_welcome_modal' );
if ( ! function_exists( 'et_builder_prepare_bfb') ):
* Maybe queue BFB opt-in modal.
function et_builder_prepare_bfb() {