Support » Plugins » Hacks » Customized Plugin Content Updating — Best Way

  • I apologize as I may have posted this in the wrong category. It may fit better here. If so, would a mod please delete the original:

    I’m relatively new to WordPress, but I’m a programmer for a living. Because of that, I don’t like reinventing the wheel. Recently, I downloaded a plugin. I can modify this post to say what the plugin was if needed, but this is more generalized. This plugin tracks items, and creates newsletters based on those tracked items.

    One of those items is Gender. Since the visitors I get are sometimes couples, they share email addresses(email is a required field), therefore I cant demand of them to each have an email, so in the Gender Field, I added Couple, tested it, and it works great. Adds an m for male, f for female, and a c for couple to the plugin’s customized table in the WordPress Database.

    Recently, the plugin had an update, and I updated it. Because I modified pieces in the plugin’s core files, the update overwrote the custom field I added, causing me to have to re-add the custom work I did. Can someone tell me what the best approach is to customizing the plugin, while keeping it up to date? Is there a hook I can use/add that will accomplish what I’m asking etc.?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    It mainly depends if the plugin author has provided hooks in the plugin or not. Some are very good at doing this, others completely ignore the idea that someone else might want to customize the plugin.

    The other factor is if the plugin itself has hooked into WP core code somewhere. If so, you could hook into the same filter or action with a larger priority number so your code runs after the plugin. Your code can then maybe alter whatever the plugin returned.

    If neither of the above are feasible, about all you can do is alter the plugin as minimally as possible, perhaps by inserting a custom apply_filter(), which code external to the plugin can hook into. Of course when the plugin updates, the filter will be lost, but if it is just one line of code, reapplying it is typically not too difficult a task.

Viewing 1 replies (of 1 total)
  • The topic ‘Customized Plugin Content Updating — Best Way’ is closed to new replies.