Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wordpress on publish hook

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 :: guzzle http try catch 
Php :: php regex validate username 
Php :: php put file in ftp server 
Php :: Drupal 9 cache killer kill switch 
Php :: setcookie php 
Php :: php remove all but numbers 
Php :: wordpress order by 
Php :: twig symfony get route 
Php :: destroy session php 
Php :: how to get the link of the current page in php 
Php :: get contents of a tmp file php 
Php :: how to add properties to the request object in laravel 
Php :: get current page slug 
Php :: laravel log permission denied mac 
Php :: group users on country vice in laravel 
Php :: wordpress escape for html 
Php :: laravel get latest record by date 
Php :: laravel permission denied storage log 
Php :: string date less than now php 
Php :: add dd function composer 
Php :: custom bootstrap pagination laravel 
Php :: ipn listener paypel php 
Php :: Search WordPress with custom field 
Php :: only alphanumeric characters are allowed regex in php 
Php :: wp override home url with php 
Php :: php directory listing 
Php :: incorrect format parameter phpmyadmin xampp 
Php :: laravel migrate only one table 
Php :: PHP strlen — Get string length 
Php :: memory limit wordpress 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =