WordPress.org

Make WordPress Core

Opened 7 months ago

Last modified 7 weeks ago

#51819 new defect (bug)

use_block_editor_for_post() not avaialble by front end

Reported by: theMikeD Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Editor Keywords: reporter-feedback
Focuses: Cc:

Description

I have a use case where I need to know if a post is using the block editor in front end code. The normal function for this check would be use_block_editor_for_post() but this is loaded for admin-only, as part of wp-admin/includes/post.php

If there is an alternative I'm all ears, but this would seem to be the right function to use, and the docs give no indication that this is admin-only.

Change History (3)

#1 @SergeyBiryukov
7 months ago

  • Component changed from General to Editor

This ticket was mentioned in Slack in #core by peterwilsoncc. View the logs.


7 weeks ago

#3 @poena
7 weeks ago

  • Keywords reporter-feedback added

Hi
This issue was discussed during a triage session today.
Can you give more details about the use case?
It was not clear if you are displaying an editor on the front, or if you want to know if any post uses blocks.

To find out if a post contains block you can try https://developer.wordpress.org/reference/functions/has_blocks/ or
https://developer.wordpress.org/reference/functions/parse_blocks/

Note: See TracTickets for help on using tickets.