How can I make my plugin/theme work with BNFW?
BNFW utilises WordPress actions to trigger these emails and send them out. If an action already causes an email to send within WordPress by default (such as when a new user registers and an email is sent to the site admin) BNFW will use a filter to change the contents of this email with the one you set-up.
Both the actions and filters that BNFW uses are the ones made available within WordPress core and as such, this provides the most compatible way to create consist and desired notifications within WordPress. You won’t find any hacky, bodged, or duct-tape solutions within Better Notifications for WP! Not all plugins or themes are made this way though – some don’t adhere to best practices or recommended methods of triggering emails and as such, compatibility between BNFW and other plugins can vary greatly. When developing or looking for a plugin or theme that works well with WordPress and BNFW, look for one from a good developer, that provides good support, and regular or frequent updates.
For reference, best practices for correctly triggering notifications using WordPress and BNFW are:
Posts / Pages / Custom Post Types
When adding posts/pages/custom post types, don’t add them directly to the database. Instead, use wp_insert_post with the appropriate post status and update the post to the final post status using the correct post status transition. This ensures BNFW can detect a new post and which post status notification should be triggered for it.
When adding new comments, use wp_new_comment instead of wp_insert_comment. This is because wp_new_command sanitizes and validates comment data and then internally calls wp_insert_comment.