meeper
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Thanks for the speedy reply!
Am I right in adding this to functions.php, instead of creating a simple logger extension? Used the code below. Nothing so far. Tried the email notif earlier, resulted to an infinite loop.
//* Send alert if text is inserted function custom_text_string_alert( $post_id ) { // If this is just a revision, don't send the email. if ( wp_is_post_revision( $post_id ) ) return; $query = new WP_Query( 's=staging' ); if ($query->have_posts()){ while ( $query->have_posts() ) { $query->the_post(); //echo 'Text has been insert at '. the_title(); // or insert function for adding this to simple history alert SimpleLogger()->info("Found a post containing test. Post id is {post_id}", array( "post_id" => get_the_id() )); } } } add_action( 'save_post', 'custom_text_string_alert' );Have found this snippet:(query for text ‘test’)
$query = new WP_Query( 's=test' ); if ($query->have_posts()){ while ( $query->have_posts() ) { $query->the_post(); echo 'Text has been inserted at '. the_title(); // or insert function for adding this to simple history alert } }Thanks for the link you provided. Although, now, it’s led to more questions.
Viewing 2 replies - 1 through 2 (of 2 total)