wp_localize_script with mce_external_plugins in wordpress

Question

I am not sure if it is possible or not.

Can i use wp_localize_script with mce_external_plugins filter?

I want to send a variable to the tinymce plugin script. For Example:

add_filter( "mce_external_plugins", array( &$this, 'add_test_plugin' ) );

public function add_test_plugin( $plugin_array ){

    global $pagenow;

    if( is_admin() && $pagenow == "post.php" || $pagenow == "post-new.php" ){
        $plugin_array['mytest'] = plugin_dir_url(__FILE__) . '/js/testing.js';
        return $plugin_array;
    }

}

I have to send a variable to testing.js? How do i achieve this?

Update:

this is the link that help me to resolve my problem Using post ID in custom tinyMCE button

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/wp_localize_script-with-mce_external_plugins-in-wordpress/">

wp_localize_script with mce_external_plugins in wordpress</a>
0
jogesh_pi 6 years 0 Answers 54 views 0

Leave an answer