Video:
https://www.youtube.com/watch?v=syaPERd4NOw&t=2447s
Without plugins, many projects in WordPress would never have been possible. Almost all developers develop add-ons to modify existing plugins to fit a client’s needs.
But how do we choose vendor plugins to develop add-ons for? What makes a plugin extensible? What makes it reliable?
These are the questions that prompted me to create a checklist for vetting plugins. The checklist starts at presales and goes to code reviewing.
This is the checklist I shared during this talk. I also received a lot of great input from other developers during the talk and was able to improve the checklist as a result.
Checklist for vetting a plugin for add-on development
Before Downloading or Purchasing
- Does it have a good support culture?
- Does it have add-ons developed by third party developers?
- Does it have a strong community?
- Do they have clear, easy on the eyes, documentation?
- Do they embrace open source?
After Activation: Administrator UX
- Does it use the WordPress UI?
- If not, is the changed UI creating a significantly better UX?
- Does it use nags tastefully?
- Does it take up minimal space for upsells?
- Does it allow for exports of user generated data?
- Ex: Form submissions.
After Activation: Database Usage
- Does it stick to WP’s built-in tables?
- If it creates new tables are they absolutely needed?
- Does it add just a handful of rows in the wp_options table?
- Is everything prefixed?
- New tables, meta keys, option keys, CPT or Custom taxonomy slugs etc…
After Activation: Performance
- Load the site up with a bunch of dummy content. I use WP-CLI, or FakerPress. The dummy content is important because you’ll only be able to see performances issues with content stressing the code.
- Use a profiler such as Query Monitor
- You can use your preferred profiler for this
Debug bar, blackfire.io. Browser Dev tools for Client side stuff.
- You can use your preferred profiler for this
- Check the Query Monitor output for red.
- Check for slow SQL queries, failing HTTP requests, or long running JS scripts.
After Activation: Uninstallation
- Does it give you the option to remove it’s data from the DB and Uploads directory? (credit to Brent Jett from the Beaver Builder Team)
Code Review: Clean Code
- Is it readable/easy to follow?
- Does it follow PHP and WP standards?
Code Review: Can you add Functionality?
- Grep do_action and apply_filters Are there a lot of them and are they all well documented in the code with a doc block?
- Does it provide a lot of actions?
- Does it allow you to filter data before saving?
- Does it allow you to filter data before it is output?
Code Review: Can you remove functionality?
- Does it use the hook pattern internally?
- Are the callbacks it adds to WP accessible?
- Use Global Vars, static methods or Singletons.
Bottom Line: Callbacks need to be accessible in some way.
- Use Global Vars, static methods or Singletons.
Code Review: ShortCodes
- Does it allow you to filter the user input for shortcode attrs?
- Does it allow you to filter the allowable shortcode attrs?
- Does it allow you to filter shortcode HTML output?
Code Review: Internal API
- Does it have an internal API to access core functionality?
- Check out WooCommerce (pre 3.0).
Code Review: Display Logic
- Does it have overridable templates?
- Does it enqueue scripts and styles?
- Does it use WordPress’ loop logic to output content?
Examples of good plugin design
- Gravity Forms- has a ton of filters to change submission data.
- WooCommerce- Overridable templates, great internal API.
- Beaver Builder- Best overridable Admin templates for module settings pages. Amazing communities of users and add-on developers.
- Ninja Forms- Breaks the rule about Admin UI design and greatly improves form creation UX as a result. An amazing community of add-on developers.
- Contact Form 7- really beautifully clean code, solid yet minimal plugin design, and amazingly extensible. Is symbolic of open source.
- CMB2- Great Developer’s meta box plugin
Slides
Useful Sources
Database Usage
- Which tables to use for what data
- What are the WP DB tables
- Problems with the options table
- Meta key best practices
- How to use post meta correctly
- How post meta gets abused
- A profiler for PHP, js, and mysql queries
- Versioning options arrays
Clean code
- PHP coding standards
- WP Coding standards
- Code mistakes in plugins
- Clean code in plugins
- Clean code in plugins
- File management in plugins