Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#39887 closed defect (bug) (duplicate)

function of wp_editor

Reported by: kkking's profile 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 8 years ago.

Download all attachments as: .zip

Change History (8)

#1 @swissspidy
8 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 8 years ago by swissspidy (previous) (diff)

#2 follow-up: @kkking
8 years ago

@swissspidy

hello ,I put this code to functions.php

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

it show like this image
http://ww2.sinaimg.cn/large/0060lm7Tgy1fcsg0pzpohj31490e8747.jpg

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

#3 @swissspidy
8 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
8 years ago

@swissspidy

add_action( 'add_meta_boxes', function(){

    $key  = "test";
    $key1 = "test1";
    add_meta_box($key1,'test',function($post)use($key){
        wp_editor('', $key);
    });
} );

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

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

#5 in reply to: ↑ 2 ; follow-up: @azaozz
8 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.

@azaozz
8 years ago

#6 @kkking
8 years ago

I've solved it, thanks everyone!

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

@azaozz ,I've solved it. thanks!

Note: See TracTickets for help on using tickets.