Well, here’s what I found. It doesn’t quite explain why the editor was breaking, but it does explain how to add a button properly, without breaking the editor.
The PHP code I was trying to add to functions.php
actually needed to be added as a plugin. Combining directions from this StackExchange post and this tutorial, I created a WordPress plugin containing the PHP given in the second link. I also followed the tutorial’s directions to create a shortcode.js
file, which I uploaded to my custom plugin’s folder. I activated the plugin via my Dashboard, and it added a working button!
When I follow the directions I originally found and add the PHP functions as a plugin, not edits to functions.php
, it also works.
Looks like using plugins, not functions.php
, was what it took to make it work.