How to add WYSIWYG Editor to TextArea Custom Meta Box in WordPress?

Custom Meta Boxes are super fun. They are very essential when building Plugins or Themes which contain much more advanced functionalities.

So let’s see how to create a Custom Meta Box with Textarea input?

Part 1. Create the Meta Box

2. Add your Textarea input field

3. Function to fetch the Value of Meta Box

4. Function to Save the Values of Meta on Admin Screen

Now, these 4 Things will Ensure that we get a Textarea Metabox and its values are being properly saved and being output wherever we want.

Now the Problem with a textarea is that a regular user doesn’t know a lot of HTML code. So he cannot create stuff like unordered lists, or format the text easily. So we need to replace the textarea¬†created in part 2 with a WYSIWYG Editor. Everything else remains the same.

Creating a WYSIWYG Editor

Delete the Code you added in STEP 2 and replace it with the following:

That’s it and the code is complete. Enjoy your WYSIWYG Custom Meta box, if you are facing any difficulty comment below and I will try to help you out.

Best WordPress Theme Frameworks for Beginners

WordPress is the most popular CMS platform on the web. Infact, this site is also running on wordpress. Most people who have recently acquired the knowledge of wordpress and Css, would like to go into WordPress theme development. Let me tell you, although HTML and CSS are sufficient to develop wordpress theme but if you want to be a better developer, you should learn some jquery and PHP too, just the basics atleast.

Continue reading