7 Responses to “wp_tiny_mce”

Hi,
I’m using wordpress 3.1, and having problem with configuration of tiny_mce for usage as editor in frontend of the site.

First of all, every try of usage wp_tiny_mce() ended up with an error about non existance of that function. Than, I copied given function source code and included it in place of call wp_tiny_mce().

I also wrote following code to make tings work:

tinyMCE.init({
theme : “advanced”,
mode : “textareas”
});

And that is the only combination of parameters that produced working editor in frontend page.

First of all, I understood that it shouldn’t be necessary to call tinyMCE.init to make things work. I saw that the function write the initialization script itself. Am I right?

Second, there is nothing I can do to make any changes on what buttons or plugins showing in tinyMCE toolbar. Using the settings array as wp_tiny_mce() second parameter doesn’t change the editors appearance. And any change in inserted tinyMCE.init produce disappearing of editor.

Could I get some help or instruction for setting up the tools in editor?

I did not experience anything like this with core WordPress 3.1 so I assume it’s a compatibility issue with one of your plugins or your theme code. Could you pass along a list of plugins and the theme you’re using?

The theme I’m using is twentyten. There is only one installed and activated plugin – Custom Post Type UI.

Let me explain conditions little more precisely.

I’m writing a plugin. It should implement functionality of making a post of custom post type by user in the front end. In the plugin code, there is declaration of function which I’m calling from inside wp-content/themes/twentyten/page.php.
From inside that function I call wp_tiny_mce(). But then I’m getting *function doesn’t exist* message. In order to fix that, I took all the code from your post above, and declared a function wp_tiny_mce() in the plugin code.
All the rest what’s happening is what was described in my comment above.

Do You think that I should include wp-admin/includes/post.php (where wp_tiny_mce is defined by default) instead of redeclaring it in my plugin?

There is one more issue probably not related, but yet maybe it is.
I can manually exclude some of the buttons directly by commenting some portions of code (eg remove bold from button array) in wp_tiny_mce() which results no change in editors buttons configuration.
Now few more functions doesn’t accept arguments… for example
$arg = array(‘post_type’=>’recipes’, ‘post_author’=>$id, ‘post_status’=>’publish’);

get_posts($arg) returns all recipes no matter which post_author is required.

So if you recognize maybe this issue, or suspect that those two may be related or caused by the same problem, please tell.

Instead of copying the function I’d just require the file it’s defined in /wp-admin/includes/post.php
This would make the function available. Altering the buttons is best done by altering the existing definitions by one of the various filters defined in this function.

First things first, By far this is greatest resource for beginner wordpress developers.

1)BTW, I’ve got the wp_tiny_mce working with no problems, it is the html editor part i can’t. How do i integrate both the HTML and visual editors in my plugin?
2) Any idea how to integrate the media buttons? Filter hook to media_buttons_context is not working.

Ouch, we don’t have this here!

It seems that we do not have anything about this topic here, but you might want to do one of the following.
If you were searching for a php function head over to the php manual and use one of their entry points

Golden Q&A rules

Search first
Be sure that you first search in Google, the WordPress forums, Codex or this site ( using the form in the menu ).
Sharing your previous results helps narrowing down the problem if you also tell us what you found and why it didn’t serve your needs.

Be specific

Give as much details about your problem as possible. Make sure to include examples, links and context related to your problem.

Be WordPress related

This site focuses on WordPress and related topics. Please make sure that your question is related to WordPress code, functionality or other related topics.

Be nice

Please keep in mind that this is a voluntary service. Answers might not always be correct or what you expect. Please be nice and let us know if any inappropriate answers come to your attention.

Buy us a coffee.

Did you find something that helps you save time or money on this site and just want to say "Thanks". Feel free to buy us a coffee using the button below.