Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My code was working up until the 3.2 update, where I noticed that tinyMCE has been updated too.

Does anyone have any ideas why this may not work now? I don't get any console errors but I don't get any tinyMCE editors on the page either!

CLARIFICATION: every instance of the TinyMCE editor has disappeared!

FURTHER CLARIFICATION: this is only occurring on my custom post type pages where I have custom instances of the TinyMCE editor. I still have the default "theEditor" MCE on the default Posts area.

function meta_genus_species() {
    global $post;

    $genus = get_post_custom_values( 'genus', $post->ID );
    $species = get_post_custom_values( 'species', $post->ID );
    $etymology = get_post_custom_values( 'etymology', $post->ID );
    $family = get_post_custom_values( 'family', $post->ID );
    $common_names = get_post_custom_values( 'common_names', $post->ID );

    if (!isset($id)) { $id = "etymology"; }
    if (!isset($temp_min)) { $temp_min = plugins_url('images/temp_max.png' , __FILE__); }
    if (!isset($temp_max)) { $temp_max = plugins_url('images/temp_min.png' , __FILE__); }
    if (!isset($pH_min)) { $pH_min = plugins_url('images/pH_max.png' , __FILE__); }
    if (!isset($pH_max)) { $pH_max = plugins_url('images/pH_max.png' , __FILE__); }

$tinyMCE = <<<EOT
    <script type="text/javascript">
        jQuery(document).ready(function($) {
            $("#{$id}").addClass("mceEditor");
            if ( typeof( tinyMCE ) == "object" &&
                 typeof( tinyMCE.execCommand ) == "function" ) {
              tinyMCE.settings = {
                theme : "advanced",
                mode : "none",
                language : "en",
                height:"75",
                width:"100%",
                theme_advanced_layout_manager : "SimpleLayout",
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "left",
                theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,temp_min,temp_max,pH_min,pH_max",
                theme_advanced_buttons2 : "",
                theme_advanced_buttons3 : "",
                setup : function(ed) {
                    ed.addButton('temp_min', {
                        title : 'Temperature: Minimum',
                        image : '{$temp_min}',
                        onclick : function() {
                            ed.focus();
                            ed.selection.setContent('[temp_min]');
                        }
                    }),
                    ed.addShortcut("ctrl+1", "temp_min", "temp_min"),
                    ed.addButton('temp_max', {
                        title : 'Temperature: Maximum',
                        image : '{$temp_max}',
                        onclick : function() {
                            ed.focus();
                            ed.selection.setContent('[temp_max]');
                        }
                    }),
                    ed.addButton('pH_min', {
                        title : 'pH: Minimum',
                        image : '{$pH_min}',
                        onclick : function() {
                            ed.focus();
                            ed.selection.setContent('[pH_min]');
                        }
                    }),
                    ed.addButton('pH_max', {
                        title : 'pH: Maximum',
                        image : '{$pH_max}',
                        onclick : function() {
                            ed.focus();
                            ed.selection.setContent('[pH_max]');
                        }
                    });
                }
              };
              tinyMCE.execCommand("mceAddControl", true, "{$id}");
            }
        });
    </script>
EOT;
    echo $tinyMCE;

    ?>
<div class="meta_control normal">
    <p>Description of taxonomy.</p>
    <div class="box">
        <label>Genus</label>
        <p>
            <input name="genus" class="text" value="<?php if(isset($genus[0])) { echo esc_attr( $genus[0] ); } ?>" />
            <span>Testing...</span>
        </p>
    </div>
    <div class="box">
        <label>Species</label>
        <p>
            <input name="species" class="text"  value="<?php if(isset($species[0])) { echo esc_attr( $species[0] ); } ?>" />
            <span>Testing...</span>
        </p>
    </div>
    <p>
        <label>Etymology</label>
        <textarea cols="50" rows="5" name="etymology" id="etymology"><?php if(isset($etymology[0])) { echo esc_attr( $etymology[0] ); } ?></textarea>
        <span>Description</span>
    </p>
    <p>
        <label>Family</label>
        <input name="family" class="text"  value="<?php if(isset($family[0])) { echo esc_attr( $family[0] ); } ?>" />
        <span>Description</span>
    </p>
    <p>
        <label>Common Names</label>
        <input name="common_names" class="text"  value="<?php if(isset($common_names[0])) { echo esc_attr( $common_names[0] ); } ?>" />
        <span>Description</span>
    </p>
</div>
    <?php

}

function meta_authored() {
    global $post;

    $species_author = get_post_custom_values( 'species_author', $post->ID );
    $year_described = get_post_custom_values( 'year_described', $post->ID );

    ?>
<div class="meta_control side">
    <label>Species Author</label>
    <p>
        <input name="species_author" class="text" value="<?php if(isset($species_author[0])) { echo esc_attr( $species_author[0] ); } ?>" />
    </p>
    <label>Year Described</label>
    <p>
        <input name="year_described" class="text" value="<?php if(isset($year_described[0])) { echo esc_attr( $year_described[0] ); } ?>" />
    </p>
</div>
    <?php
}
share|improve this question
2  
What exactly stopped working? Did the button disappear, etc.? –  kaiser Jul 11 '11 at 8:03
    
Sorry, should've made that more clear. Every instance of the editor has disappeared! –  dunc Jul 11 '11 at 17:33
1  
I'm seeing a similar issue with one of my custom post types also. If the supports parameter of register_post_type() includes editor then everything works fine, but if it doesn't then TinyMCE doesn't even get registered to $wp_scripts. I'll add a bounty to the question to see if anyone can find an answer. It seems like a lot of changes were made in 3.2, but I haven't been able to pinpoint which ones would cause this. –  Ian Dunn Jul 27 '11 at 21:50
    
Are you using the old WordPress Automatic Upgrade plugin instead of the native built-in updater? If so, disable the old plugin, go to Dashboard->Updates, and do a re-install. The old plugin does an incomplete upgrade of TinyMCE, resulting in all sorts of weirdness. –  Otto Jul 27 '11 at 22:43
    
I'm not sure about Ian but I used the native updater. –  dunc Jul 27 '11 at 23:07

3 Answers 3

up vote 2 down vote accepted

I found some info on changes in 3.2 that might be relevant:

Aparrently, wp_tiny_mce_preload_dialogs() no longer exists from WP3.2 on. It got replaced by wp_preload_dialogs() which is now being called from wp_quicktags(). wp_quicktags, on his turn, is being called from the_editor() function. So, if you’re using the_editor() you no longer need to manually call the function to preload any dialogs!

If you’re not using the_editor(), make sure to call wp_preload_dialogs() somewhere from your footer in the following manner:

wp_preload_dialogs( array( 'plugins' => 'wpdialogs,wplink,wpfullscreen' ) );

You could try calling wp_preload_dialogs(), or maybe switch to using the_editor() instead of tinyMCE.execCommand().

Also, check out this question; calling wp_tiny_mce() solved my problem.


Update: wp_tiny_mce() might be deprecated in 3.3.

share|improve this answer
    
Ian, thanks so much for posting again. I'm investigating now, so I'll update soon. –  dunc Aug 3 '11 at 16:46
    
Woooohoooo, it works! The link you gave me in the last sentence, to "this question", fixed my problems. Thank you SO much Ian! –  dunc Aug 3 '11 at 16:53
    
Sweet, I'm glad that fixed your problem too :) –  Ian Dunn Aug 3 '11 at 18:03

The possibility that your custom TinyMCE code broke you theme is pretty, but please - before trying to change or debug it - deactivate your plugins first and - if it doesn't help - switch to the default theme and see if it works.

Then take a look at your meta_genus_species() function and start commenting out the ed.addButton blocks of code. See if it works. If it does, uncomment one, check the result, uncomment the next one, etc.

share|improve this answer
1  
Thanks kaiser. This isn't for a theme, it's for a number of custom plugins which I'm writing to use WordPress as my CMS. However, your point is still valid and as soon as I sit down to do some work tonight I'll try blocking out the code to pin-point the problem. Thanks. –  dunc Jul 14 '11 at 10:47

There is a problem with WP 3.2 and the Visual Editor

Try this:

Anyway, for us, our fix was to open up wp-admin/admin-footer.php and comment out line 36

do_action('admin_footer', '');

Read this: http://documentation.diyartportfolios.com/visual-editor-not-workin

and this: http://wordpress.org/support/topic/upgraded-to-32-visual-editor-buttons-missing

share|improve this answer
    
Hi Daniel. Thanks for that - I've given it a go to no avail. I should probably clarify further that I have the editor as usual in the "Posts" section, just not in my custom post types pages. –  dunc Jul 12 '11 at 8:24
1  
Making changes to core WP files is never a good answer. –  mike23 Jul 12 '11 at 8:30
    
I upgraded to 3.2.1 and it solved the no Visual Editor Problem. It may help your problem, as well. –  danielwiener Jul 13 '11 at 12:03
    
You got me excited there daniel, but unfortunately it hasn't resolved my problems. Thanks anyway :) –  dunc Jul 14 '11 at 10:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.