• Resolved TWD

    (@twd)


    I need to write a custom plugin that clears the Beaver Builder cache BEFORE a Saved Row is “Saved” (ie. updated) for ANY Saved Row template.

    I’ve tried this code but when I click “Publish” on a Saved Row (from the front end) it just hangs.
    ie. doesn’t publish

    Any thoughts?

    <?php
    /**
    * Plugin Name: Clear BB Cache Before Saved Row Update
    * Description: Clears the Beaver Builder cache before updating any Saved Row.
    * Author: Yours Truly
    * Version: 1.1
    */

    if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
    }

    // Hook into Beaver Builder's before save layout action.
    add_action( 'fl_builder_before_save_layout', 'clear_bb_cache_before_update_saved_row', 10, 2 );

    /**
    * Clear Beaver Builder Cache Before Updating Saved Rows
    *
    * @param int $post_id The post ID.
    * @param array $data The layout data.
    */
    function clear_bb_cache_before_update_saved_row( $post_id, $data ) {
    // Check if the post is a saved row.
    if ( 'fl-builder-template' === get_post_type( $post_id ) ) {
    // Clear the Beaver Builder cache.
    if ( class_exists( 'FLBuilderModel' ) ) {
    FLBuilderModel::delete_asset_cache();
    FLBuilderModel::delete_all_transients();
    }
    }
    }
    Expand
Viewing 1 replies (of 1 total)
  • Plugin Support Danny

    (@dannyholt)

    Hi @twd

    Unfortunately, we can’t provide support here, as this forum is dedicated to the free lite version available on the www.remarpro.com plugin repository. Saved rows is a premium feature.

    For support with your premium products, please contact us directly at https://www.wpbeaverbuilder.com/. You’ll find links to support and the contact form in the footer.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.