Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#45263 closed defect (bug) (fixed)

The posts page is editable in the block editor

Reported by: chouby's profile Chouby Owned by:
Milestone: 5.0 Priority: normal
Severity: normal Version: 5.0
Component: Editor Keywords: has-screenshots fixed-5.0
Focuses: Cc:

Description

WordPress used to remove the editor for the posts page thanks to:

if ( $post_ID == get_option( 'page_for_posts' ) && empty( $post->post_content ) ) {
	add_action( 'edit_form_after_title', '_wp_posts_page_notice' );
	remove_post_type_support( $post_type, 'editor' );
}

in edit-form-advanced.php.

This behavior is lost with the block editor in WP 5.0.

Attachments (1)

Screen Shot 2018-11-06 at 10.43.58 AM.png (117.2 KB) - added by desrosj 6 years ago.

Download all attachments as: .zip

Change History (14)

#1 @danielbachhuber
6 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 5.0

Thanks for the report, @Chouby

#2 @desrosj
6 years ago

  • Keywords has-screenshots added

This ticket was mentioned in Slack in #core-editor by desrosj. View the logs.


6 years ago

#4 follow-up: @pento
6 years ago

  • Keywords fixed-5.0 added; needs-patch removed

[43883] accidentally included the fix for this. 🙂

#6 @pento
6 years ago

@swissspidy: That's correct, the block editor currently doesn't support editing a post without the content area, so it has to fall back to the classic interface.

#7 @littler.chicken
6 years ago

@pento, I'm not seeing that this has been fixed. I'm running 5.0-RC1-43946, with Twenty Nineteen. Whether or not Gutenberg is active, the block editor loads for my blog/posts page, although the theme does not display anything added to the page content/blocks. There is no reversion to the classic interface.

#8 @desrosj
6 years ago

@littler.chicken can you provide more details on how to reproduce what you are seeing? What are you using for a testing environment?

I have tried the following:

  • Blog page as draft.
  • Blog page pubished.
  • Plugin on.
  • Plugin off.
  • The same page assigned to Home Page and Blog Page (this shows a warning in the Reading Settings area, but appears to save).

#9 @littler.chicken
6 years ago

This is a local setup using PHP7.2, 5.0-RC1-43946, Twenty Nineteen, and no plugins active.

I have a static front page set, and then a page assigned to be the posts page (published). If I disable the static front page, but leave the posts page, the behavior is unchanged. If I activate Gutenberg, the posts page continues to load in the block editor.

With Gutenberg active, if I add the classic-editor query string to the URL by hand, I get a modal asking me to confirm if I want to use the Classic Editor for content previously edited in Gutenberg. When I confirm, the redirect white screens with a JavaScript error:

Uncaught TypeError: Cannot read property 'then' of undefined at post.php?post=79&action=edit&classic-editor:1808

related to this script:

window._wpLoadBlockEditor.then( function() {
	wp.data.dispatch( 'core/edit-post' ).setAvailableMetaBoxesPerLocation( {"side":[],"normal":[],"advanced":[]} );
} );

If I deactivate Gutenberg and leave the query string in, the posts page loads in the block editor.

If I set the front page and the posts page to be the same, I get the warning on the Reading settings page, but the page continues to be editable in the block editor.

#10 @swissspidy
6 years ago

  • Keywords fixed-5.0 removed

This is still an issue. Whether I'm using RC 2 or Gutenberg 4.6.1, the posts page does load in the block editor, not the classic editor.

#11 @Chouby
6 years ago

It works for me in RC2. Could it be that the post content is not empty?

#12 @swissspidy
6 years ago

  • Keywords fixed-5.0 added

Ah. Indeed that was the case. *facepalm*

#13 in reply to: ↑ 4 @SergeyBiryukov
6 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Replying to pento:

[43883] accidentally included the fix for this.

Merged to trunk in [44242].

Note: See TracTickets for help on using tickets.