Skip to main content Skip to navigation Skip to footer

How can I make my plugin/theme work with BNFW?

Updated

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.

Comments

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.

Users

When adding users, don’t add them directly to the database, use the wp_insert_user and wp_update_user functions.

Privacy Overview

This website uses cookies so that it can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to this website and helping employees to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

This website uses the Stripe Payment Processor. Cookies from Stripe are required in order for this website to provide eCommerce functions, such as to accept payments.

This website uses YouTube to host and display videos relating to the operation of this plugin and forms part of the documentation. Use of cookies from YouTube is required in order to fully document or explain elements of a product.

PHPSESSID - This cookie is native to PHP applications. The cookie is used to store and identify a users' unique session ID for the purpose of managing a user's session on the website. The cookie is a session cookies and is deleted when all the browser windows are closed.