Show Default Editor on Blog Page ( Administration Panel )

In WordPress 4.2 it included a nice feature which labeled what page was the Front-Page and which page was the Blog ( Latest Posts ). Unfortunately, it also removes the default editor on the page assigned to show the latest posts and instead shows this message:

You are currently editing the page that shows your latest posts.

I want to assign content to the blog page to show above my latests posts via:

get_post_field( 'post_content', get_option( 'page_for_posts' ) );

How can I re-add the default WP Editor to the Blog Page in the administration panel without adding a separate metabox?

2 s
2

In WordPress 4.2 the editor was removed on whichever page was assigned to show Latest Posts for whatever reason. The following function below
( original solution found here by crgeary ) will re-add the editor and remove the notification:

You are currently editing the page that shows your latest posts.

Here’s some information on the hooks used:

  • edit_form_after_title – Used to remove the above admin notice.
  • add_post_type_support – Used to give editor support back to the Latest Posts page.

if( ! function_exists( 'fix_no_editor_on_posts_page' ) ) {

    /**
     * Add the wp-editor back into WordPress after it was removed in 4.2.2.
     *
     * @param Object $post
     * @return void
     */
    function fix_no_editor_on_posts_page( $post ) {
        if( isset( $post ) && $post->ID != get_option('page_for_posts') ) {
            return;
        }

        remove_action( 'edit_form_after_title', '_wp_posts_page_notice' );
        add_post_type_support( 'page', 'editor' );
    }
    add_action( 'edit_form_after_title', 'fix_no_editor_on_posts_page', 0 );
 }

Edit for WordPress 4.9

As of WordPress 4.9.6 this fails to re-instate the editor. It looks as though the action edit_form_after_title isn’t called soon enough. This modification, called on the earliest non-deprecated hook following the editor’s removal in edit-form-advanced.php, seems to work OK.

Apart from the change of hook, there’s a change to the number of parameters too.

if( ! function_exists( 'fix_no_editor_on_posts_page' ) ) {

    function fix_no_editor_on_posts_page( $post_type, $post ) {
        if( isset( $post ) && $post->ID != get_option('page_for_posts') ) {
            return;
        }

        remove_action( 'edit_form_after_title', '_wp_posts_page_notice' );
        add_post_type_support( 'page', 'editor' );
    }

    add_action( 'add_meta_boxes', 'fix_no_editor_on_posts_page', 0, 2 );

 }

Leave a Comment