Support » Fixing WordPress » Where to put a modified TinyMCE plugin?

  • Hello,

    I want to use the TinyMCE codesample plugin in a forum on my frontend but the functionality was not 100% like I want it. I have no JavaScript or WordPress development experience but with some little research I was able to make the necessary changes in the JS file.

    Now I was told that I shouldn’t modify plugins in wp-includes directly but I can’t figure out what else I should do. It’s difficult to find real step by step instructions for that as a noob. Mosty people say things like “use hooks” but I don’t know where to go from there.

    Let’s say I have the JS code for a modified pluing – is there a place I can put it in 1 piece and be done?

Viewing 7 replies - 1 through 7 (of 7 total)
  • You should create a WordPress plugin to be a place to store the JS and to load it correctly. You can start with something like Hello Dolly, if you need a template. Or use PlugInception plugin to create the skeleton for you.
    What it should do is check for whether you are on the editor page, and remove the core JS plugin from the loading queue, then load your modified one.

    Here’s the plugin handbook: https://developer.wordpress.org/plugins/
    Here’s the filter reference: https://codex.wordpress.org/Plugin_API/Filter_Reference
    Action reference: https://codex.wordpress.org/Plugin_API/Action_Reference
    and the code reference: https://developer.wordpress.org/reference/

    Thank you, I will go through these links.
    What about going directly into the wp-includes folder of the TinyMCE plugin and modifying it directly? Is that bad practice? I have done that on the codesample plugin which is not added by default.

    If it’s not core code you are changing, that’s different. You shouldn’t change core code.
    But if you have a plugin that needs a change, you can ask the author. You can also make a copy of it, make your changes, and rename it so you can tell them apart and the changed one won’t get overwritten with an update. Then delete the old and use the new. (But it won’t get any additional updates.)

    Thank you very much! So non-core plugins don’t get overwritten with normal WordPress updates? Only if I were to update the plugin directly?

    Just to make that clear, I am talking about a TinyMCE plugin, not a WordPress plugin. It is in the folder wp-includes/js/tinymce/plugins (I put it there)

    • This reply was modified 1 month, 4 weeks ago by  flizzywp.
    • This reply was modified 1 month, 4 weeks ago by  flizzywp.
    • This reply was modified 1 month, 4 weeks ago by  flizzywp.

    You should not make any changes in the WordPress folders. They do get deleted on updates, and the new ones extracted from the zip that is downloaded from wordpress.org.
    This is the same process as WP plugins in the plugins folder. Just because it’s called a plugin for tinymce doesn’t mean it’s the same thing. It will be deleted on a WP update if it’s only in the wp-includes folder.

    Can you tell me where I would put that TinyMCE plugin instead?

    I already told you what I suggest. Make a WP plugin.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.