The Better Notifications for WordPress Custom Fields Add-on (BNFW CF) allows you to do two things:
- Use custom fields for posts, pages, and custom post types in your notifications.
- Use custom user fields from a user’s profile in any BNFW notification that allows you to use the user shortcodes except for the registration notifications (but you can in the Post-registration Email notification).
It provides a number of new shortcodes allowing you to include data from custom fields in both the subject and message body of your notifications. It also allows you to set one or multiple custom fields that will ‘trigger’ the notification and cause it to be sent. It works great with ACF’s front-end forms (acf_form) too.
Shortcodes can be used in the From Name, Email, and Reply To fields (where these fields are supported by WordPress).
Supported Custom Field Plugins
The custom field plugins that are supported for posts, pages, or custom post types are:
- Advanced Custom Fields Pro
- Advanced Custom Fields (Free)
- Meta Box
- WordPress’s own, default custom fields
Some parts of Toolset Types may work but it isn’t officially supported by this add-on and as such, support can’t be provided when using the BNFW Custom Fields add-on and Toolset Types.
User Profile Custom Fields
You can also include data from custom fields in a user’s profile (user meta data), providing that it’s created using WordPress’s standard user_meta_fields, either via ACF, WordPress, custom code, or another supported plugin. These can be used in any of the notifications that supports the set of User shortcodes except for the New User Registration notification because the user custom fields have not been saved by WordPress by the point that this notification is sent.
This add-on also works great with the Conditional Notifications add-on.
Available Custom Fields
The custom field types that you can currently use in your post, page, and custom post type notifications are:
- WYSIWYG Editor
- Radio Button
- True / False
- Page Link
- Color Picker
Please Note: Data is retrieved and displayed in the form that it is stored in the database. E.g. Dates are displayed in YYYYMMDD format, files are outputted as IDs and not full URLs, etc.
Creating a Field Group and Fields in ACF
I’m going to presume you know how to create custom fields using ACF however, if you don’t, please follow the ‘Creating a Field Group’ documentation over on the ACF website.
If there are any particular custom fields that you’d like to use to ‘trigger’ a notification to be sent later on, make a note of their names. This is shown next to the label when editing a Field Group.
Creating a Custom Field Notification
After installing and activating the new ‘BNFW – Custom Fields Add-on’ plugin, go to Notifications > Add New in the sidebar of the WP Admin.
Setting up a notification here is just like setting up any other notification in BNFW except there are a few new options.
In the Notification For selection box, you’ll see new options under Posts, Pages, and any custom post types that you’ve got set-up. Select one of these to show the other custom field settings for this notification.
Once you’ve done this, you can then choose which custom field(s) you’d like to use to ‘trigger’ the notification to be sent out in the Send when these Custom Fields are Updated selection box. This box will show all custom fields available on your site, not just the ones created in ACF.
You can search through the list by typing in the box to narrow down your selection. If you don’t see the custom field that you’ve just created in the box, be sure to check your spelling. If you still don’t see it, you may have to populate the custom field first for it to show. Once you’ve selected your custom fields(s), you can then set-up the rest of the notification as you wish.
Custom Field Shortcodes
You can include the data stored in custom fields in the subject and message body of your notifications too. To do this, you’ll need to use a new shortcode:
Just replace X with the custom field name that you noted down earlier.
E.g. If your custom field name was text_box, then your shortcode would read
Custom User Field Shortcodes
If you’d like to use a custom field from a user’s profile in any BNFW notification that supports recipient user shortcodes, you’ll need to use this new shortcode:
If you want to use a custom field from the post/page author’s profile in a notification, use this shortcode:
If you’re using Toolset Types to create your custom user fields, you may need to prepend any of these with wpcf- in order for it to show properly. E,g.
Once you’ve added everything that you want to your notification, Save it and test it out.
This shortcode can be used in any of the notifications that supports the set of User shortcodes except for the New User Registration and Post-registration Email notifications because the custom fields have not been saved by WordPress by the point that these notifications are sent.
Still have a question? Ask me a pre-sales question here and i’ll gladly help.
Subscribe for BNFW News
Want to know when new add-ons or features are released? Sign up to the newsletter. No spam, ever. Unsubscribe at any time.