• Resolved bytejockeyz

    (@bytejockeyz)


    I’m experiencing an issue with the WPRM block displaying in the editor of Custom Posts Types. I can create a new Custom Post, add the WPRM block (which does display), choose the recipe I want, and publish the Custom Post. If I then go back to the editor of the Custom Post I just published, the WPRM block won’t display, and shows an error that reads “This block contains unexpected or invalid content”.

    The post still renders the recipe correctly when I view the post, and I don’t have this issue when I add a WPRM block in a normal Post. I’ve also disabled all plugins to see if there is some kind of plugin conflict – no dice. I’d like the block to display correctly in the editor because I need to move some of the text from the Recipe Summary into the post itself, which I could do if the WPRM block displayed correctly and would let me edit the recipe. Any idea what’s causing this issue?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Brecht

    (@brechtvds)

    Could you try adding the following code to the functions.php file of your (child) theme?

    add_filter( 'rest_prepare_cpt', array( 'WPRM_Fallback_Recipe', 'replace_fallback_rest_api' ), 10, 3 );

    Make sure to replace “cpt” in ‘rest_prepare_cpt’ with the actual custom post type.

    As a temporary solution you can always edit recipes through the WP Recipe Maker > Manage page, by the way.

    Thread Starter bytejockeyz

    (@bytejockeyz)

    That did the trick, thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Invalid Content Error with Custom Post Type’ is closed to new replies.