Breaking vs Non-Breaking Plugin Changes

If you’re anything like me, when you open up old files, you like to clean them up while working in them. It only adds a small amount of time to your work and is the most convenient time to “get around” to cleaning things up. There are some things we can improve in our files without breaking anything on the site. (Of course, still test locally and/or on a staging environment.)

Breaking Plugin Edits

  • Renaming a Plugin’s Directory – The old path will be broken and the plugin will be deactivated. Once renamed, you can reactivate it from the WP admin or update the path in the database. (Note the apostrophe, though renaming the “plugins” directory will also break. It will deactivate all plugins, except any in “mu-plugins.”
  • Renaming Main Plugin File (the one with the file header) – The old path will be broken and the plugin will be deactivated. Once renamed, you can reactivate it from the WP admin or update the path in the database.
  • Changing Rewrites/Slugs – You’ll just need to flush permalinks via WordPress admin or database.

Edits That Won’t Break Plugins

(As long as you catch every reference to the renamed items. – Tip: Use a Search Across Files/Directories feature in your text editor/IDE.)

  • Renaming Functions and References to Them
  • Renaming Scripts/Styles Called and References to Them
  • Changing the Return Value of a Shortcode

Ways to Avoid Things Breaking

Make incremental changes, for example:

  • If you’re renaming a shortcode, just declare it twice. You don’t need to search & replace the references in wp_posts right away unless you’re prepared for that. This will break the task down into smaller, less overwhelming pieces.
  • If you’re renaming a custom post type, leave the slug alone for the time being. Update the labels and template filenames.

Was this post helpful?