If you’re operating under the assumption that wp_insert_user()
sends the notification, then that’s where the problem is. That function just inserts the user – it does not by itself send any emails.
You can use the function wp_send_new_user_notifications( $user_id )
to send user notification. However, you need to trigger it based on the result of your wp_insert_user()
. Check to make sure you have a user ID and not an error in your result:
if ( ! is_wp_error( $user_id ) ) {
wp_send_new_user_notifications( $user_id );
} else {
// you have an error...
}
Note that the wp_send_new_user_notifications()
function will send to the user and an admin notification by default (so you don’t have to specify “both”).
Related Posts:
- Send user activation email when programmatically creating user
- Writing a plugin that notify my friends of new post that mentions(@) them
- wp_mail not recognizing cc and bcc headers
- WordPress is automatically linking plain text email addresses
- How can I pass get_the_author_meta(‘user_email’) through the REST API?
- wp_mail() headers multipart/alternative
- Warning: include(): https:// wrapper is disabled in the server configuration by allow_url_include=0
- How to add a hyperlink to the email content in WordPress?
- How to get custom post_author?
- What is the way to hook all wordpress email
- Serial Number from custom table not appear in woocommerce_email_before_order_table action
- Using wp_mail to send email?
- How to show comments from different Plugins to same post type?
- How to check if `comment_meta` exists before inserting the comment?
- How to get the `comment_post_ID`?
- Email content as comment
- WordPress mails being sent from @locahost and being rejected
- Update Option Stored in Multi-Dimensional Array
- check if Gutenberg is currently in use
- WordPress Plugin Development – Headers Already Sent Message
- Get page content using slug
- How to include wp-load.php from any location?
- Correct way to enqueue jquery-ui
- How to echo the_excerpt without the P tag wrapper?
- How can I update a wordpress plugin from a Git repository (github)
- $wpdb->insert_id
- Remove profile picture option (and other things) from profile.php (in admin)
- How to disable plugin update notification for a specific plugin in Multisite
- Getting old term value with edited_{$taxonomy} | Hook
- Building a better media uploader for WordPress
- Problems with localization
- Calling clean_term_cache() fails when called in the same plugin that creates terms, succeeds when called separately?
- Singular name Plugin localization
- On plugin deactivation hide its shortcode
- Can I submit a plugin that follows the PSR-2 coding style guide?
- How to get current page id through the plugin
- Properly licensing a plugin that uses Apache 2.0 licensed code
- How to restrict plugin’s sub-menu pages to admin/subscribers?
- Saving data from block editor to the database
- Cannot search post by taxonomy
- OOP Plugin and Menu – Call to undefined function register_setting()
- Will current_theme_supports return TRUE with a nonstandard add_theme_support?
- How to untrash a post only if it was not a draft?
- Display content from custom post without modifying the single template
- How do I add custom column to woocommerce cart?
- Calling is_single() outside the loop
- update woocommere total value on checkout based on selected payment method
- Loading WordPress Admin Environment
- how to add custom functionality after woocommerce place order button
- Problems with: manage_${post_type}_posts_columns
- Getting timestamp of activation plugin time
- Rich text editor settings persist throughout all rich text editors
- Function: Add link to / inside div
- How can I rewrite a URL to pass requests to a custom method via AJAX? (I can’t use admin-ajax.php)
- WP Gutenberg Blocks – How to limit first/root blocks
- How do I update a field of a meta box?
- Following WordPress Markup Is mandatory, got awkward resultyby wordpress standard markup?
- How to Get Current Custom Post Type Associated Taxonomy Term
- Issue on Setting $icon_url Parameter on WP add_menu_page()
- Are there any official or unofficial guidelines for the styling of a widget?
- How to get error object returned by wp_create_user
- Logout after clicking URL link results in “headers already sent” error
- My WordPress Plugin code breaks customize.php viewpoint
- Custom filter not working
- Make wordpress join default user metas with a column from another table while displaying the wp_users table on the users screen
- ajax working when function is on child theme but not in plugin page
- I need to refresh page to display wp_get_current_user() : why?
- $wpdb->prepare is not working like mysql_real_escape_string
- Adding Dynamic Stylesheet
- Enqueue ONLY Plugin Styles and Scripts
- Foreign wp_users ID in custom plugin DB table?
- Metabox is not displaying
- How to replace the existing metatag using the backend to insure a thumbnail image gets fetched when we share on social media?
- When setting styles to an extended block that was saved as a pattern, it doesn’t remove the style that was there
- apply_filters() and call_user_func() to define and call a function outside a class
- HTML Elements in my WP Plugin being generated in JS. Security and Translated Text Question about this method being used
- Sanitization and validation input fields – Settings API
- Author Meta in Author URL Link
- Warning: Illegal string offset ‘Andorra’ in … on line 106
- Different style for specific rows in custom list table using WP_List_Table
- wordpress4.8.2 Multilingual Plugin
- get_comment_meta() for a filter hook in a plugin
- form does not generate $_POST request
- Callback function quicktags that uses variable in start tag
- Font Awesome stopped showing icons, shows &# text instead [closed]
- WordPress Plugin Tool Tip Helpers
- How can I add the Post ID to Class Name in Jquery?
- How to show metabox just in post.php in admin?
- $wpdb how can i save my postmeta table before querying it
- Create dedicated page with custom template showing custom data
- Can’t switch theme after activation
- plugin will not offer update even though a new version is available
- WordPress plugin: admin-ajax.php not passing data to custom function
- How do I replace title with my plugin?
- Enqueue Script in custom plugin before other
- How to remove a class [closed]
- How can I dynamically change title and description in WordPress?
- Need someone to help you want to manage points for members to code interface functions? thank you
- WordPress plugin boilerplate AJAX functionality
- Run different permission_callback depending on HTTP method of custom REST API endpoint