How to add custom buttons in WordPress TinyMCE Editor?

WordPress comes with a visual editor of TinyMCE by default. You can use this to add and edit posts and pages. There are several buttons on the editor toolbar that you can use to format the content. You can also add your own buttons to the editor toolbar. Creating custom TinyMCE buttons is a great feature that can add a lot of value to WordPress plugins or themes.