When you return $post->post_content
you’re returning the raw content from the database. Things like shortcodes, dynamic blocks and responsive image markup will not exist in the content. To prepare content for output you need to run it through the the_content
filter:
'content' => apply_filters( 'the_content', $post->post_content ),
That being said, there is already an endpoint for retrieving a single post, so you’d be better off just using that.
Related Posts:
- Gutenberg Block manipulation: Undo parse_blocks() with serialize_blocks() results in unicode issues
- 404 in gutenberg autosave of a Custom Post Type with custom rest_namespace
- Editor API Endpoint or Data Store That Provides a List of Meta Fields for Post Types
- Is it possible to access the wp-admin from one instance while keeping WP_HOME pointing to the balancing url?
- Custom Endpoint API based on attribute gutenberg block
- Proxy External API request in PHP from Edit.js in Block Plugin
- Custom validation on publish/ update in Block Editor
- How to Analyze Blocks and find Intersection and patterns between pages
- Unable to edit server side rendered block
- apiFetch() returns infinite requests
- Block editor – Too many requests for server host
- fetch more than 100 records in block editor API call
- Block editor not loading with rest api custom code
- Add pre-publish conditions to the block editor
- How can I access core/paragraph textColor in a block template
- Implement Panel Color Inspector Control in Gutenberg
- Gutenberg InspectorControls is deprecated, how to add custom block settings?
- How should you internationalize javascript spread in multiple files but build in one?
- Why is onChange={ ( content ) => setAttributes( { content } )} now used?
- How to set column widths in a CPT block template?
- Access GutenBerg data with Javascript?
- Only show focused toolbar for Gutenberg Block with Multiple text fields
- Gutenberg: How to Change Post Status Programmatically?
- Enhancing Gutenberg featured image control
- Is it possible to create column width presets in Gutenberg?
- Testing custom themes / plugins under Gutenberg
- Gutenberg LinkControl suggestionsQuery not working
- Gutenberg – How to prevent block from being deleted and reordered/moved
- WordPress Gutenberg Columns block
- Gutenberg InnerBlocks predefined block supports
- Is it possible to bulk migrate all deprecated instances of a gutenberg block?
- How to Add a Container Class to Standard Gutenberg Blocks
- How to display InnerBlocks in render callback
- Gutenberg – button to parse and format all blocks?
- Custom WP Block using Inner Blocks crashes editor, doesn’t save content
- Save/update post_meta with Gutenberg from the panel
- Gutenberg Button Border Radius Default
- Disable title block on edit screen for a custom post type
- Gutenberg: Block validation fails if editor is reloaded or post is edited. data.getBlocks(); is empty in save function
- Delete a Gutenberg Block Programmatically?
- Can Gutenberg be used as an editor on a page?
- Import external data into post using custom Gutenberg block
- How do a I add an attribute to element (when using block theme)?
- How to transform block variant to default version?
- How can I add a color picker to a custom Gutenberg block which includes the default system palette from theme.json?
- How to makes Custom Post Type posts as Gutenberg’s patterns?
- Can’t run WP e2e-test-utils because the browser exits on login?
- Modify the InnerBlocks ‘Add block’ block appender label
- Do I need wp-tinymce-js?
- Custom Post Type and Custom REST API Endpoint result in Gutenberg editor not working
- wp_schedule_single_event issue with save_post hook in gutenberg
- Gutenberg TextareaControl escapes html
- Block editor fails to update HTML section when the word “from” is in source code
- Gutenberg extending the existing class
- Creating Block templates with ‘core/heading’ other than level 2
- how to trigger a Gutenberg image gallery lightbox
- How to put and components inside in Gutenberg block
- Wp-script package stop to work
- CheckboxControl does not visible change
- Get a term object using getEntityRecords
- How to import Reusable Blocks programatically?
- Setting font sizes in theme.json
- Is it possible to disable font sizes on sub blocks only?
- Get selected block every time a new block is selected in Gutenberg
- Block patterns: Any way to reset the pattern to whatever is in the code?
- Block variation / Variation API scope “transform”
- Is there a function to “blockify” html?
- Gutenberg get list of all custom image sizes
- How to set a template part area?
- Video Block does not autoplay
- Upgraded to wordpress 5.7 and now I can’t select myself as a post author
- Extend the “Convert to Blocks” feature to add additional functionality
- Blocks. How to store default settings?
- Gutenberg/WordPress – Limit number of categories
- Block editor not displaying properly
- Can the Gutenberg editor be toggled closed?
- Guenberg Block Not Saving – When additional div added
- How to open WordPress media create/edit Gallery Dialog
- Pages are editable in Gutenberg, but posts are coming up in classic editor
- WordPress custom block compatability with WPML
- Add a button to the Gutenberg editor header
- Component toggle not toggling
- Disabling gutenbeg slow down post saving
- How to solve react dom ‘removeChild’ on Node error while google translate extension is on and selecting any core block [closed]
- How to use react in frontend of dynamic blocks?
- Attempting to specify viewScript, in a custom block, results in a register_block_script_handle error
- What is the standard way to use the version of React that ships with Gutenberg on the front end?
- Restricting core block nested blocks
- Is is possible to use Templates with blockprops?
- How to add readable name and description to templates?
- Errror generated in console leading to block validation failer
- Add Custom Block Supports to Core Block
- Block validation failed – save content vs post body content
- How to propegate changes from block render_callback to other blocks using that callback?
- wordpress 6.2 is alignfull and lignwide removed?
- Where’s the Block Template Feature in WordPress?
- Is it possible to add custom Components in the InspectorControls to the new “Styles” Tab?
- How to implement Mapbox GL JS with a custom Gutenberg block in FSE?
- Hard code block with nested block in front-page.html template
- Use a custom block inside another custom block