1

It appears that when I have two+ separate wp_editors with different values for drag_drop_upload they all are built as if they have drag_drop_upload set to true.

If I set them all to false they act as expected, but if they have different values they do not.

Here is code to demonstrate:

add_action( 'add_meta_boxes', function() {

    add_meta_box( 'asdf123_editors', 'Editors', function() {

        wp_editor( 'Drag/Drop => True', 'asdf123_editor_1', array(
            'drag_drop_upload' => true,
        ) );

        wp_editor( 'Drag/Drop => False', 'asdf123_editor_2', array(
            'drag_drop_upload' => false,
        ) );

    }, 'post' );

});

If you prefer, here's the code as a gist

Is this a bug?

0

Not sure if this is a bug, but the behaviour is correct, or at least apparently intentional.

a) There is only one dragDropUpload setting in the tinyMCEPreInit object, instead of one flag per editor.

b) looking at class-wp-editor.php:139:

 if ( $set['drag_drop_upload'] ) {
    self::$drag_drop_upload = true;
 } 

so, if the setting is set to true once, it is true and stays true. One way ticket to complete trueness.

Feels like a bug. But even if this could be reset to false, it would be false for all editors then. Doublebug? Double chance for a mention in WordPress ~4.5 ;)

But to be fair: This is somehow bound to the media modal, and i guess setup is once on pageload..in other words, might be difficult to handle this on a per-editor basis. Codex/Docs should make this setting more clear. Or maybe a global filter to turn this on/off would be more appropriate.

| improve this answer | |

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.