You may call the function too early. You have to wait until the action 'plugins_loaded'
fires.
wp_mail()
is defined in wp-includes/pluggable.php
.
pluggable.php
is loaded in wp-settings.php
after the plugins are loaded but before 'plugins_loaded'
is called.
See this answer for an example.
Related Posts:
- What is the advantage of using wp_mail?
- Fatal error: Call to undefined function wp_mail()
- wp_mail not recognizing cc and bcc headers
- Problem with `wp_mail()`
- Do I have to override the wp_mail() pluggable function with writing a plugin?
- How to send email in wordpress with more than one attachments
- wp_mail() headers multipart/alternative
- White screen when activating plugin that sends form via WordPress
- Warning: include(): https:// wrapper is disabled in the server configuration by allow_url_include=0
- How to get post meta in functions?
- Using wp_mail to send email?
- Allow user to add the php code in wp_mail()
- wp_mail links are dead
- wp_mail_from not changing from address
- Unit testing for plugin development
- How would I create a plugin for my shortcodes?
- How to check WordPress website username and password is correct
- How to sync with plugins update after I have done manual optimizations?
- How to retrieve a value via get_option when the option_value is stored in a multi-dimensional array?
- Custom theme sufficient or custom plugin neccessary for this feature set?
- How to change wordpress post title?
- Check spam in custom form – akismet
- Add Admin Menu Inside Construct or Init
- get plugin directory url
- WordPress cron running twice
- How to create thumbnail of different files?
- Admin-ajax.php appending a status code to ajax response
- comment_email hook doesn’t seem to work for comment editor field
- How can I add a field to make link nofollow to the WordPress Link Inspector Window?
- Version upgrade: can my plugin filter the SQL statements issued during a database upgrade?
- admin_notices not displaying in plugin
- Get Objects While Deleting term
- js/css updating when making a plugin
- settings_fields() doesn’t work for other roles except admin
- Subscribe to author?
- how to make custom bulk actions for a WP_List_Table (core class)
- Get name and email of current unregistered user, who has recently submitted name and email in comment form?
- Set page template programaticlly in plugin
- Auto save permalink setting page with the plugin activation
- creating custom function to log actions in plugin
- How to use output buffering in WordPress hooked functions?
- Plugin menu addition in multisite
- Show custom data instead of 404
- Mixing and Matching – Custom templates in a WordPress plugin
- What’s the right way to instantiate new blocks and/or the plugin itself in toto when using wppb architecture?
- How to get Metabox custom field to show checked if value is updated using post meta query?
- Serve text/html from wp-json API via WPEngine, headers not being set properly
- wp_schedule_event seems to be being added twice
- How to Move the Comments Bubble to the Right Side of the Toolbar
- How should I go about registering JavaScript that isn’t a file? [duplicate]
- What happens when two or more plugins use the same hook?
- How to pull user/author profile data in a plugin?
- Adding columns to core tables
- Add child pages to submenu automatically
- Injecting HTML on (arbitrary) admin pages
- Custom Stylesheet instead of Inline CSS for WordPress Customizer API Overrides
- AJAX button with success callback. (Titan Framework)
- Information on plugin adding text when a post, page, or other such is displayed
- How to relate the Category to user?
- Plugin’s total number of users
- How to edit wp-signup.php content using plugin
- Setting post_id for single.php based on URL without a redirect
- WordPress: redirecting to the form page after form submission to admin-post.php
- why is apiFetch throwing Unhandled Promise Rejection: TypeError: Object is not a function
- Change cannonical URL after changing url with add_rewrite_rule()
- Conditionally check if page is using template from plugin directory
- plugin css is not being applied to the page
- Is it possible to develop themes and plugins locally while still allowing content to be updated directly in the admin dashboard?
- Is there any way to get post meta from publish_post hook?
- How to save multiple values in custom post type from front end to back end
- How to create plugin settings page for each admin user?
- Using JavaScript in WordPress page to call for server data using AJAX
- Insert Data into Database
- login_message filter not working
- Displaying Custom Post Meta
- How to return a blank page
- Array/List Edit in Backend
- How to Modify My Plugin’s Admin Settings so that the Plugin can be Added to a Specific Page?
- Does WordPress have something like timer hook?
- Same header/footer in Admin, across all network sites in multisite
- Template file structure , wordpress hook for altering the template
- Wrapping shortcodes in another shortcode
- Display Data’s metabox in page
- WordPress multiple user roles accessing on their information on one site?
- How to add ‘use_desc_for_title = 0’ to all wp_list_categories calls?
- How can I start Plugin Development?
- How to create a database table in WordPress using PHP
- Render raw html in Gutenberg block
- How can I create a custom plugin to call webapi after user registration?
- Displaying an Uploaded Image as a Custom Avatar in WordPress
- Rest Api WordPress
- How to create A – Z List with pictures?
- How do I display and edit other posts within the ‘Edit Post’ area of Wp-Admin Dashboard
- A better way of getting draft posts that has a particular post meta using get_posts function
- Save translation file of third party plugin in a custom plugin?
- Custom rewrite, url path with parameters to a page
- Developing an IP lookup function using an API
- Making a user platform reachable by a qr code on a pin-back-button [closed]
- how to add contact form 7 shortcode in javascript variable
- select rows based on exact time (hours, minutes and seconds)