• Resolved zingiri

    (@zingiri)


    Using wp_editor($content,$editor_id) is now throwing javascript error:

    “wp.media.view.settings.post is undefined”

    Looks like it is located in tiny-mce.

    The only way around it is to use

    wp_editor($content,$editor_id, array( ‘media_buttons’ => false )) which of course doesn’t display the media buttons.

    How can this error be avoided?

Viewing 5 replies - 1 through 5 (of 5 total)
  • And I have the same problem – media_buttons not work with wp 3.6…
    for a test, I used this simple code

    <?php require_once('../wp-load.php'); ?>
    <!DOCTYPE html>
     <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            <title>Thickbox test</title>
    	</head>
    
    <body>
    <div id="editorwrapper">
    	<form action="#" method="get">
    			<?php
    			$args = array( 'media_buttons' => true );
    			wp_editor( '<p>Some content</p>', 'editortest', $args );
    			?>
    			<input type="submit" value="Submit" />
    	 </form>
    </div>
    
    <?php do_action( 'wp_footer' ); ?>
    
    </body>
    </html>
    Thread Starter zingiri

    (@zingiri)

    Good to see I’m not the only one with the issue.

    I found the solution – in my case, need to add

    wp_enqueue_script('post');
    wp_enqueue_media( array( 'post' => $post_id ) );

    before

    $args = array( 'media_buttons' => true );
    wp_editor( '<p>Some content</p>', 'editortest', $args );

    And in wp 3.6 media button works again.

    Thread Starter zingiri

    (@zingiri)

    This seems to have done the trick here as well. You can actually use an arbitrary number instead of $post_id, any number will do.

    I am having issues with WP MU … It keeps telling me “An error occurred in the upload. Please try again later.”… on a upload media pop-up (once a file is uploaded and supposed to be saved)

    Setup is: All sub-blog admins are going to https://www.MainDomain.com/members page and on that page I’ve managed to put wp_editor…. I am loading all admin scripts on that page and I am using switch_to_blog($userblog_id); but error still shows… no errors thrown in server log… any ideas ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_editor throwing js error "wp.media.view.settings.post is undefined"’ is closed to new replies.