Here is the full code:
$busman = fep_get_meta( fep_get_parent_id(fep_get_the_id()), ‘cus_fep_business’, true );
$args = array(
‘mgs_type’ => ‘message’,
‘mgs_status’ => ‘publish’,
‘mgs_parent’ => 0,
‘per_page’ => 10,
‘fields’ => [ ‘mgs_id’, ‘mgs_title’ ],
‘participant_query’ =>
[
[
‘mgs_participant’ => $busman,
],
],
‘meta_query’ =>
[
[
‘key’ => ‘cus_fep_update’,
‘value’ => ‘driverupdate’,
],
],
);
$mgs = fep_get_messages( $args );
if ( $mgs ) {
foreach ( $mgs as $mg ) {
fep_update_meta( $mg->mgs_id, ‘test_meta’, ‘test’ );
}
}
wp_reset_query();
If I add this code into the page and load it as normal, all of the messages update with the new meta. However, if I add this code into add_action( ‘fep_action_message_after_send’, function( $message_id, $message, $new_message ){ it does not work. That action is working ok for all the other meta that is being added and updated in it.
Debugging is something that is beyond my skill set at the moment but I will look into it. Any other ideas you have would be appreciated.