• I am running v 0.5.0 of this plugin with WP 6.0.1 and anything I activate a new plugin or make a change to my theme.json or any block.json files the content of all my pages and posts disappears.

    • This topic was modified 2 years, 3 months ago by Troy Chaplin.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Troy Chaplin

    (@areziaal)

    I should note that I just noticed that once this plugin is deactivated all the content reappears. Then disappears again if reactivated.

    hahilts

    (@hahilts)

    The same thing happens for me! Is there any chance this will get fixed?

    Thank you!

    Thread Starter Troy Chaplin

    (@areziaal)

    I think it’s safe to assume this plugin is dead… Sad, it was super handy given there appears to be zero care about having the blocks in the API as a part of WP Core

    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

    @jordithinkmoto

    If you want to ask for support, please start your own topic instead. I’m closing this old thread.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Page content disappears’ is closed to new replies.