Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • jordithinkmoto

    (@jordithinkmoto)

    Hi @areziaal ,
    I have the same issue as you. Did you manage to solve it?

    I have tried also to add this code in functions.php, but the same problem is happening:

    add_action('rest_api_init', function () {
        if ( ! function_exists( 'use_block_editor_for_post_type' ) ) {
            require ABSPATH . 'wp-admin/includes/post.php';
        }
        // Expose Gutenberg blocks in the WordPress REST API
        
        $post_types = get_post_types_by_support( [ 'editor' ] );
        
        foreach ( $post_types as $post_type ) {
            if ( use_block_editor_for_post_type( $post_type ) ) {
                register_rest_field($post_type, 'blocks', ['get_callback' => function ( array $post ) {
                    return parse_blocks( $post['content']['raw'] );},]);
            }
        }
    });

    Any idea how to solve it?

    Thanks

    Thread Starter jordithinkmoto

    (@jordithinkmoto)

    Hi Kathryn,
    I’m using a child theme of Twenty Twenty-Three. Doo you think this could be the problem? I have already deactivated all plugins and the same problem is happening.

    Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)