Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#39887 closed defect (bug) (duplicate)

function of wp_editor

Reported by: kkking Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.2
Component: Editor Keywords:
Focuses: Cc:

Description (last modified by swissspidy)

add_action( 'add_meta_boxes', function(){

    $key = "test";
    add_meta_box($key,'test',function() use($key){
        wp_editor('', $key);

} );

Attachments (1)

metabox-editor.png (8.6 KB) - added by azaozz 3 years ago.

Download all attachments as: .zip

Change History (8)

#1 @swissspidy
3 years ago

  • Component changed from Gallery to Editor
  • Description modified (diff)
  • Focuses administration removed
  • Keywords reporter-feedback added

Hey there,

Welcome to Trac! What exactly is the problem with wp_editor()?

Last edited 3 years ago by swissspidy (previous) (diff)

#2 follow-up: @kkking
3 years ago


hello ,I put this code to functions.php

open "wp-admin/post-new.php"

it show like this image

Version 0, edited 3 years ago by kkking (next)

#3 @swissspidy
3 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Ah thanks, now I see what you mean.

This issue is being tracked in #19173.

From the comments there:

wp_editor() shouldn't be used in a metabox. do_action('edit_page_form') or do_action('edit_form_advanced') are the proper places for it.

This only applies for wp_editor() with the visual editor enabled. HTML-only should be fine.

#4 @kkking
3 years ago


add_action( 'add_meta_boxes', function(){

    $key  = "test";
    $key1 = "test1";
        wp_editor('', $key);
} );

I find if $key equal $key1,it's show http://ww2.sinaimg.cn/large/0060lm7Tgy1fcsg0pzpohj31490e8747.jpg

Last edited 3 years ago by swissspidy (previous) (diff)

#5 in reply to: ↑ 2 ; follow-up: @azaozz
3 years ago

Replying to kkking:

hello ,I put this code to functions.php

open "wp-admin/post-new.php"

it show like this image...

Just tested this and it works as expected here. Of course the editor "crashes" if you move the metabox in the dom as @swissspidy mentioned above, but it works properly if you don't. Please check the rest of your code or any active plugins that may interfere with the CSS or JS.

3 years ago

#6 @kkking
3 years ago

I've solved it, thanks everyone!

#7 in reply to: ↑ 5 @kkking
3 years ago

@azaozz ,I've solved it. thanks!

Note: See TracTickets for help on using tickets.