Denden
(Denden)
October 30, 2024, 3:15pm
1
Since a few days/weeks when duplicating a page all of the element get merged in a huge Text editor block, destroying all layout and making it impossible to use existing pages as base for new layout.
For example duplicating this page:
gives me this atrocity:
I have not added any new plugin or made any change to the plugin or functions.php files.
Denden
(Denden)
October 31, 2024, 9:05am
3
I tried both the “Duplicate page” button in the Pages section in the dashboard and the “Duplicate layout” in the Tools menu while in the Beaver Builder
My only workaround so far is to save the page as a custom template and apply it to a blank page
pross
October 31, 2024, 12:15pm
4
are you using siteground “optimiser” and do you have jetpack ative?
Denden
(Denden)
October 31, 2024, 1:19pm
5
I do have SG Speed Optimizer but not Jetpack, here’s the list of my plugins
Beaver Builder Plugin (Pro Version)
Beaver Themer
Cookie Notice & Compliance for GDPR / CCPA
Customizer Export/Import
eForm - WordPress Form Builder
EWWW Image Optimizer
Simple Custom CSS and JS
Site Kit by Google
Speed Optimizer
Strong Testimonials
Ultimate Addons for Beaver Builder
Wordfence Security
Yoast SEO
I had the same plugins when it was still working fyi
pross
October 31, 2024, 1:39pm
6
Do you have memcache enabled in SG “optimiser”?
pross
October 31, 2024, 1:59pm
8
Try disabling it.
Weve seen issues with that setting enabled… but last report the user was using jetpack
If you are happy to do some testing, leave it enabled and disable each other plugin in turn to see if you can find the combination that causes the issue.
Denden
(Denden)
November 14, 2024, 9:28am
10
Disabling the memcache seems to do the trick, thank you for that. If you have a permanent fix i’m all ears
pross
November 14, 2024, 1:00pm
11
Open class-fl-builder-model.php
find the function duplicate_post
and replace with the following
static public function duplicate_post( $post_id = false ) {
global $wpdb;
$post_id = ( ! $post_id ) ? self::get_post_id() : $post_id;
$post = get_post( $post_id );
$current_user = wp_get_current_user();
$template_id = false;
$meta_data = '';
// Duplicate the post.
$data = array(
'comment_status' => $post->comment_status,
'ping_status' => $post->ping_status,
'post_author' => $current_user->ID,
'post_content' => $post->post_content,
'post_excerpt' => $post->post_excerpt,
'post_name' => $post->post_name . '-copy',
'post_parent' => $post->post_parent,
'post_password' => $post->post_password,
'post_status' => 'draft',
/* translators: %s: post/page title */
'post_title' => sprintf( _x( 'Copy of %s', '%s stands for post/page title.', 'fl-builder' ), $post->post_title ),
'post_type' => $post->post_type,
'to_ping' => $post->to_ping,
'menu_order' => $post->menu_order,
);
// Get the new post id.
$new_post_id = wp_insert_post( $data );
// Duplicate post meta.
$post_meta = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM {$wpdb->postmeta} WHERE post_id = %d", $post_id ) );
if ( count( $post_meta ) !== 0 ) {
foreach ( $post_meta as $meta_info ) {
$meta_key = $meta_info->meta_key;
if ( '_fl_builder_template_id' == $meta_key ) {
$meta_value = self::generate_node_id();
} else {
$meta_value = addslashes( $meta_info->meta_value );
}
if ( '_fl_builder_data' === $meta_key ) {
$meta_data = $meta_value;
}
// @codingStandardsIgnoreStart
$wpdb->query( "INSERT INTO {$wpdb->postmeta} (post_id, meta_key, meta_value) values ({$new_post_id}, '{$meta_key}', '{$meta_value}')" );
// @codingStandardsIgnoreEnd
}
}
// Flush the cache so new meta is returned in wp meta functions.
wp_cache_flush();
// Duplicate post terms.
$taxonomies = get_object_taxonomies( $post->post_type );
foreach ( $taxonomies as $taxonomy ) {
$post_terms = wp_get_object_terms( $post_id, $taxonomy );
for ( $i = 0; $i < count( $post_terms ); $i++ ) {
wp_set_object_terms( $new_post_id, $post_terms[ $i ]->slug, $taxonomy, true );
}
}
// Get the duplicated layout data.
$data = $meta_data;
// Generate new node ids.
$data = self::generate_new_node_ids( maybe_unserialize( stripslashes_deep( $data ) ) );
// Update template ID and template node ID
$template_id = get_post_meta( $new_post_id, '_fl_builder_template_id', true );
$global = get_post_meta( $post_id, '_fl_builder_template_global', true );
if ( $template_id && $global ) {
foreach ( $data as $node_id => $node ) {
$data[ $node_id ]->template_id = $template_id;
$data[ $node_id ]->template_node_id = $node_id;
}
}
// Save the duplicated layout data.
self::update_layout_data( $data, 'published', $new_post_id );
// Also update draft data
self::update_layout_data( $data, 'draft', $new_post_id );
// Return the new post id.
return $new_post_id;
}
system
(system)
Closed
November 19, 2024, 10:42am
12
This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.