• Hi,

    I am looking to build a custom wiziwig, and replace wordpress’s TinyMCE all together. Now I figured out how to add to the TinyMCE editor, but thats not what im looking for. Does anyone have any references for a starting point? Googling it only came up with the option to add to TinyMCE, not replace it with something custom all together. I’m new to theme development, so something detailed would be great. I really just need a starting point, then I should be able to get it from there.

    Let me know if you have any questions

    Thanks in advance,
    Zac

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Sorry, I’ve no detailed reference for you. I believe you can remove the TinyMCE editor entirely with remove_post_type_support(). You can then place your own editor in a custom meta box, which despite its name, does not need to be only for meta data. Because WP thinks editing is no longer supported, you’ll need custom code to place the new editor content into the DB when the post is saved or updated.

    At least a starting point I hope.

    Thread Starter Zachary Nespral

    (@duke03)

    Thanks bcworkz! remove_post_type_support() helped a lot. I already built the editor and im using a meta box to do so I got everything working except being able to save the content. Would you know how I would go about saving the content into the DB? That’s the last thing I need to make this work ??

    Moderator bcworkz

    (@bcworkz)

    Yes, I do know! And you apparently do not really need much detail ?? Nice work!

    There are a few actions you can hook to manage this, the obvious one is ‘save_post’. There are other actions fired through wp_transition_post_status(), some of which are dynamic actions that fire only under specific conditions, which offers us greater control of when our code actually needs to execute. I suspect ‘save_post’ will work for you, the rest is probably just FYI.

    As you likely know, you can get the form’s content through $_POST. What you shouldn’t do is call wp_update_post() to insert the form content because it’ll call your action callback and start an infinite loop! While there’s ways to prevent that, I think the simplest is to use the global $wpdb database interface object to directly update the appropriate post line in the DB.

    Be sure you validate and sanitize the form content before placing it in your DB! Confusing the issue is most $wpdb methods require the use of $wpdb->prepare(), however update and insert do not. It’s best to examine the wpdb class definition to assure yourself this is indeed the case.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Replace TinyMCE with Custom Built Editor’ is closed to new replies.