Created
May 12, 2020 10:33
-
-
Save janneleppanen/9b733418c1152e690cdaf4a6b950b4e1 to your computer and use it in GitHub Desktop.
Add Gutenberg editor to page_for_posts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Add editor support for posts page. | |
| * If the posts page has content, the editor will turn to Gutenberg. | |
| * | |
| * @param object $post Post object. | |
| * @return void | |
| */ | |
| function add_editor_for_posts_page( $post ) { | |
| if ( ! isset( $post->ID ) || absint( $post->ID ) !== absint( get_option( 'page_for_posts' ) ) ) { | |
| return; | |
| } | |
| add_post_type_support( 'page', 'editor' ); | |
| } | |
| add_action( 'edit_form_after_title', 'add_editor_for_posts_page', 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment