Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Wordpress hook for newly published post

function so_post_40744782( $new_status, $old_status, $post ) {
    if ( $new_status == 'publish' && $old_status != 'publish' ) {
        $author = "foobar";
        $message = "We wanted to notify you a new post has been published.";
        wp_mail($author, "New Post Published", $message);
    }
}
add_action('transition_post_status', 'so_post_40744782', 10, 3 );
Comment

PREVIOUS NEXT
Code Example
Php :: http error 500 phpmyadmin 
Php :: how to echo line number in php 
Php :: get category name by id wordpress 
Php :: change laravel mix to run on different port 
Php :: php maxupload 
Php :: php get string between two strings 
Php :: pdo fetch 
Php :: select in php mysql 
Php :: foreach comma separated string php 
Php :: get product price wordpress 
Php :: seed date laravel 
Php :: php alert 
Php :: how to hide .php extension using .htaccess 
Php :: php read xml file into array 
Php :: get count of results based on groupBy laravel 
Php :: run php server mac 
Php :: get duplicate value from array php 
Php :: Remove Downloads link from Woocommerce my account page 
Php :: getoriginal laravel 
Php :: wordpress if is in categroy 
Php :: remove slashes from json php 
Php :: how to mantain text in form after error php 
Php :: laravel gmail 
Php :: not required a field when checked not applicable checkbox in laravel 
Php :: laravel gigapay list employee 
Php :: créer projet laravel 
Php :: check if $_files is empty php 
Php :: add softDelete in modeldata laravel 
Php :: wordpress wpdb 
Php :: how to check the size of mysql database in phpmyadmin 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =