A Plugin Has Poor Documentation? Here’s How to Dissect Them

Have you ever wanted to customize some a plugin, googled how to do it, but found no result? Read more to see how to proceed from that

Pre-requisite: Knowledge about what is Action and Filter. You can learn about it here.

Have you ever wanted to hook into a plugin, googled how to do it, but found no result?

Yes, incomplete/poor documentation is a common thing in WordPress development.

In this article, we will take a look at a plugin called Events Manager that has 100.000+ active installations but has no documentation about its Hooks.

Step 1: CTRL + SHIFT + F

Proper code editor like Sublime or VisualStudio Code has a functionality to search all files. Usually, the shortcut is CTRL (or ⌘ in Mac) + Shift + F.

So, open the plugin folder and search for one of these two: apply_filters if you need to change a value or do_action if you want to insert some codes at a certain place.

Search result of “apply_filters” in Visual Studio Code

Step 2: Find What You Need

Scan through the filter names and see which one seems like the one you need.

What I need is to add “IDR (Indonesian Rupiah)” to the Currency selection because for some reason, it’s not there.

Hmmm, that filter named em_get_currencies seems likely. So I clicked on that to see the full code:

Found the code that handles Currency list

That’s definitely what I’m looking for!

Step 3: Hook into That Filter

You got the filter name and the parameter. Now, hook into that:

add_filter( 'em_get_currencies', function( $currencies ) {

  $currencies->names['IDR'] = 'IDR - Indonesian Rupiah';
  $currencies->symbols['IDR'] = 'Rp';
  $currencies->true_symbols['IDR'] = 'Rp';

  return $currencies;
} );

I opened the Events Manager settings and Voila! It’s there:

New currency is added to the Setting’s dropdown

Conclusion

This tip gives you a general idea on how to split-open a plugin. The difficulty is definitely going to vary for each of you.

From my experience, if a plugin has mid or high active installations, you can expect a lot of Hooks to be available.

If it has low active installation, then it’s a risk to be using that plugin in the first place.

If you have experience dissecting a plugin, let me know how it goes in the comment below 🙂

Default image
Henner Setyono
A web developer who mainly build custom theme for WordPress since 2013. Young enough to never had to deal with using Table as layout.
Leave a Reply