6

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?

  • I had the same problem with wordpress 5. Editor was missing from the Blog page. I just trashed the default blog page created by wordpress and restored it from the trash. Now the restored blog page is having the default editor. – Rinto Vr Mar 22 at 9:16
14

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:


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 );

 }
  • As of WordPress 4.9 this still removes the notice but doesn't re-instate the editor. – Andy Macaulay-Brook Jul 4 '18 at 16:59
  • 1
    Added an edit explaining what seems to have changed between WP4.2 and WP4.9. Hope that's the way to do things - didn't seem I should add a new answer. – Andy Macaulay-Brook Jul 4 '18 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.