add_action(‘save_post’ .. not firing
-
what is wrong?
thanks
howardmy code – activated by require_once
———————————–<?php function my_log($msg){ $date=date_create("now"); $fdate = date_format($date,"Y/m/d H:i:s"); $abs_path = 'C:\a_wp_dev\htdocs\scr\my_log.log'; //$log = fopen ("./my_log.log" ,'a'); $log = fopen ($abs_path,'a'); $written = fwrite($log, PHP_EOL . $fdate . ': ' . $msg. PHP_EOL); $ok = fclose($log); } my_log('started'); function my_save_post_action( $post_object ) { // modify post object here my_log('my_save_post_action' . var_export($post_object)); } add_action( 'save_post', 'my_save_post_action' ); function my_shutdown( ) { // modify post object here my_log('my_shutdown'); } add_action( 'shutdown', 'my_shutdown' );
———————
from the log, after adding a page2020/06/16 15:28:20: started
2020/06/16 15:28:20: my_shutdown
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘add_action(‘save_post’ .. not firing’ is closed to new replies.