add_action('publish_post', 'email_post');
function email_post($postID)
{
$post = get_post($postID);
$content = $post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$mailto = 'youremail';
$subject="New Post";
if(mail($mailto, $subject, $content))
return true;
else
return false;
}
Be sure to set your headers or anything else you might need to populate your email correctly. This is untested, but it should help get you started. Also consider using the ‘save_post’ hook.
I’ve posted this same reply on StackOverflow, so if this helps, please mark both of these as answered.
Related Posts:
- Customizing subject in comment notification e-mails
- Making plugin unique to not conflict with plugins with the same name
- How to find out if option exists but is empty?
- How to pass JavaScript variable to PHP in wordpress widget?
- Unable to add admin notice on plugin activation
- How To Ignore a Filter On Applying Filter the Content In a Function
- Saving Plugin settings to the database
- Add CSS animation as Preloader to WordPress
- Errors while using ajax from external wordpress page
- shortcode doesn’t work
- Deleting images through upload folder, but not deleting from media library
- WordPress plugin installation
- Create or Update thousands of woocommerce products via PHP
- send_headers don’t work on wordpress multisite
- Plugin exceeds memory limit
- Update Option Error: Notice: Undefined index
- How to trigger $_GET request within admin plugin page?
- How to generate video out of images via WordPress plugin
- How can I get WordPress to save comments in markdown format?
- How to ‘clone’ a wp plugin to make small changes
- Where should I save an API key of my user when installing my plugin?
- Custom form action to handle data inside a plugin
- Self deactivate plugins after an action occurs
- How to periodically scrape and cache strings from remote txt files. – My First Plugin
- WP Post Template – Templates in own folder
- Avoid class name collision when using third party libraries in plugins?
- Edit Yoast SEO breadcrumbs output [closed]
- Redirection of users away from wp-admin (but not administrators)
- Using a custom plugin to capture input data via Ajax and PHP
- Image upload and download from front-end
- wp_remote_get() returns 403 while file_get_contents() does not
- How to output CMB2 select options from repeated groups select elements?
- 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
- Ajax call returning 0
- How to deal with WordPress and Pocket API to automate content curation on my hosted wordpress blog? [closed]
- WP All Import – Execute Imports
- Conditional attributes and logic per product category
- Perform internal redirect in WordPress?
- How to prevent plugins from loading jQuery
- WordPress get_avatar function not correct working
- Check if variable is set in filter
- Include a php file from another plugin
- How to redirect to same page after form submission
- Add User Role: Pre-saved in User-Meta [SOLVED]
- Plugin onclick button activate other plugin
- How to create plugin/ page that reads from database
- Save user total active time after login in wordpress [closed]
- Creating a functionality plugin to edit seriously simple podcasting
- How WordPress core manage the plugin installation
- Switch from wp-cron to a server cron job
- Asynchronous request in wordpress
- Make plugin php file called directly aware of WordPress?
- Calling a save function from a “submit” button
- Wp Debug Enabled True Notices and Warning
- Next Previous Post in wordpress with previous / next link with title?
- Apply html elements in php statement
- Settings options not showing up on Sub Menu page in WordPress plugin
- can’t unzip file
- i need to make custom cron_schedule with custom interval time as a parameter into a custom payment gateway plugin wordpress
- How to create admin setting for this small plugin
- Allow a particular user to access a particular plugin?
- Cookie value changes back to previous value after changing
- Change plugin descriptions
- The Build menu theme is frozen with the wordpress theme
- Problem with checked box on wp car manager plugin
- How can I translate something in my class constructor of my plugin in WordPress?
- Define global variable in theme file and call that variable in plugin file
- Rename a folder via HTML POST request
- How to translate to spanish wordpress hardcoded content/files?
- update_post_meta is not working for me when I use e.preventDefault for update button
- SimpleXML is not working with xml response from external api
- How to use Datatable with Ajax when creating plugin on WordPress?
- WordPress plugin blog creation
- Multiple image selection custom widget
- Prefix WordPress Taxonomy Tags With Hashtag Symbol Like Twitter
- Change Woo Custom Endpoint Titles from a Plugin
- Showing how many times is plugin activated or deactivated
- Woocommerce list variations that are added already to cart in Single Product
- WordPress Admin sub-level menu issue
- Plugin communication between sites that use it?
- Passing ajax variable to more than one wordpress plugin function
- Form tries to download a file on submit
- Populate select option with JSON file
- insert multiple entries in database using a loop issue
- Displaying friend’s posts only
- Theme editor removes backslashes
- Plugin Hook: Get posts
- Plugin Breaking WordPress Login
- How to get site homepage from plugin?
- Undefined variable _POST
- How use Dynamic hyperlink on each wordpress post?
- Unable to show 4 products in a row
- What is the source outline for a basic word press plugin?
- What can I do to customize a widget provided with this plugin? from where have I to start?
- wp_handle_upload – specified file failed upload test
- How to make a Template page to show the information of different things Shop and Product page?
- How to trigger plugin migration code when plugin updates?
- How to Save Category and Delete Category in same Function
- public custom posts not showing in my wordpress plugin
- Accessing Correct Database to Create REST API Endpoint