feat: Divi 5.14.0 freigeben, Version 0.6.1

Divi 5.14.0 ändert SyncToServerController::update(): Vorlieben und
Workspace werden nicht mehr dort gespeichert, der Haupt-Post nur noch
bei singulären Builder-Speicherungen geschrieben. Die drei nachgebauten
Builder-Kennzeichen (_et_pb_use_divi_5, _et_pb_use_builder,
_et_pb_show_page_creation) werden unverändert gesetzt – Referenz und
Fingerabdruck per `wp lit-mcp divi-check --update-reference` nachgezogen,
Prüfung und divi-write-smoke.sh gegen 5.14.0 grün. 5.14.0 steht damit in
DiviReleases::TESTED.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-10-08 16:58:34 +02:00
co-authored by Claude Fable 5.1
parent 1b73f0652a
commit e5f0c65eb0
6 changed files with 24 additions and 30 deletions
+15 -25
View File
@@ -2,11 +2,9 @@ function update( WP_REST_Request $request ) {
$post_id = (int) $request->get_param( 'post_id' );
$post_status = $request->get_param( 'post_status' );
$content = $request->get_param( 'content' );
$preferences = $request->get_param( 'preferences' );
$page_settings_by_layout = $request->get_param( 'pageSettingsByLayout' );
$sync_type = $request->get_param( 'syncType' );
$options = $request->get_param( 'options' );
$workspace = $request->get_param( 'workspace' );
$prime_cache_url = $request->get_param( 'prime_cache_url' );
$main_loop_type = $request->get_param( 'mainLoopType' );
$main_loop_type = is_string( $main_loop_type ) ? $main_loop_type : 'singular';
@@ -48,9 +46,9 @@ function update( WP_REST_Request $request ) {
: [];
// Guardrail: never allow empty placeholder-only payloads to overwrite Theme Builder layouts.
$header_has_content = self::_has_meaningful_layout_content( $header_content );
$body_has_content = self::_has_meaningful_layout_content( $body_content );
$footer_has_content = self::_has_meaningful_layout_content( $footer_content );
$header_has_content = SavingUtility::has_meaningful_layout_content( $header_content );
$body_has_content = SavingUtility::has_meaningful_layout_content( $body_content );
$footer_has_content = SavingUtility::has_meaningful_layout_content( $footer_content );
if ( ! $header_has_content ) {
$header_post_id = 0;
@@ -194,9 +192,12 @@ function update( WP_REST_Request $request ) {
}
}
$main_post = get_post( $post_id );
$has_main_post_context = $main_post instanceof \WP_Post;
$update = $has_main_post_context ? wp_update_post( $post_update_data ) : 0;
// Persist main post content/meta only for singular VB saves.
// On non-singular pages (home/archive), request post_id may be the first
// main-query loop post and must not be converted to Divi (#49679).
$main_post = get_post( $post_id );
$should_persist_main_post = $main_post instanceof \WP_Post && 'singular' === $main_loop_type;
$update = $should_persist_main_post ? wp_update_post( $post_update_data ) : 0;
$layout_updates = [
[
@@ -321,9 +322,9 @@ function update( WP_REST_Request $request ) {
// all post meta (including appended canvas content) is available.
SavingUtility::prime_page_cache_on_save( $post_id, $prime_cache_url );
if ( ( $update && ! is_wp_error( $update ) ) || ( ! $has_main_post_context && ! is_wp_error( $update ) ) ) {
if ( ( $update && ! is_wp_error( $update ) ) || ( ! $should_persist_main_post && ! is_wp_error( $update ) ) ) {
// Update post meta so we know D5 is used and Readiness migrator will skip it.
if ( $has_main_post_context ) {
if ( $should_persist_main_post ) {
update_post_meta( $post_id, '_et_pb_use_divi_5', 'on' );
// Also set the legacy meta for backward compatibility with D4 components.
update_post_meta( $post_id, '_et_pb_use_builder', 'on' );
@@ -350,17 +351,6 @@ function update( WP_REST_Request $request ) {
update_post_meta( $layout_id, '_et_pb_use_builder', 'on' );
}
$preferences = SavingUtility::sanitize_app_preferences( $preferences );
foreach ( $preferences as $preference_key => $preference_value ) {
$option_name = 'et_fb_pref_' . $preference_key;
et_update_option( $option_name, $preference_value );
}
// Updated last used workspace.
$last_used_workspace = $workspace['last-used'] ?? [];
Workspace::update_item( 'builtIn', 'last-used', $last_used_workspace );
/**
* Action hook to fire when the Post is updated.
*
@@ -385,8 +375,8 @@ function update( WP_REST_Request $request ) {
*/
do_action( 'divi_visual_builder_rest_update_post', $post_id );
$saved_post_content = $has_main_post_context ? get_post_field( 'post_content', $update ) : $post_content;
$verification = $has_main_post_context
$saved_post_content = $should_persist_main_post ? get_post_field( 'post_content', $update ) : $post_content;
$verification = $should_persist_main_post
? self::_verify_post_content_matches_after_sanitization( $post_content, $saved_post_content )
: true;
@@ -417,7 +407,7 @@ function update( WP_REST_Request $request ) {
$return_rendered_content = $options['return_rendered_content'] ?? false;
if ( $return_rendered_content && $has_main_post_context ) {
if ( $return_rendered_content && $should_persist_main_post ) {
// Replace dynamic data in the content with the actual value.
$normalized_content = DynamicData::get_processed_dynamic_data( $saved_post_content, $post_id, true );
@@ -429,7 +419,7 @@ function update( WP_REST_Request $request ) {
return self::response_success(
[
'post_status' => $has_main_post_context ? get_post_status( $update ) : $post_status,
'post_status' => $should_persist_main_post ? get_post_status( $update ) : $post_status,
'save_verification' => $save_verification_filtered,
'rendered_content' => $rendered_content,
]