PluginProbe
BeyondWords – AI audio for publishers / 7.2.0
BeyondWords – AI audio for publishers v7.2.0
7.2.0 7.1.0 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 All 44 releases
← All changes | src/post/class-sync.php +15 -2 7.1.0 → 7.2.0 View file →
@@ -582,14 +582,15 @@
582 582 register_meta(
583 583 'post',
584 584 $key,
585 585 [
586 - 'show_in_rest' => in_array( $key, $rest_keys, true ),
586 + 'show_in_rest' => in_array( $key, $rest_keys, true )
587 + ? [ 'prepare_callback' => [ self::class, 'prepare_rest_meta_value' ] ]
588 + : false,
587 589 'single' => true,
588 590 'type' => 'string',
589 591 'default' => '',
590 592 'object_subtype' => $post_type,
591 - 'prepare_callback' => 'sanitize_text_field',
592 593 'sanitize_callback' => $sanitize_callback,
593 594 'auth_callback' => static fn(): bool => current_user_can( 'edit_posts' ),
594 595 ]
595 596 );
@@ -649,8 +650,20 @@
649 650
650 651 $response->set_data( $data );
651 652
652 653 return $response;
654 + }
655 +
656 + /**
657 + * Serve legacy meta over REST as a string: scalars cast, anything else ''.
658 + *
659 + * Core's default serves non-strings as null, which the block editor echoes back and core
660 + * then rejects; see doc/rest-meta-visibility.md.
661 + *
662 + * @param mixed $value The stored meta value.
663 + */
664 + public static function prepare_rest_meta_value( $value ): string {
665 + return is_scalar( $value ) ? (string) $value : '';
653 666 }
654 667
655 668 /**
656 669 * Hide BeyondWords meta from the legacy "Custom Fields" panel.