2 replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
source | link

I'm familiar with how to set custom messages for post updateshow to set custom messages for post updates using the post_updated_messages action hook. This question is slightly different.

I have a function/action hook on post_updated:

function my_custom_function($post_id) {
  $response = ping_other_service_and_get_confirmation($post_id);
  syslog(LOG_INFO, 'Response:' . $response['body']);
  return $response['body'];
}
add_action( 'post_updated', 'my_custom_function');

Assuming that the ping_other_service_and_get_confirmation() function pings some other web service, letting it know that the post has been updated, and returns a confirmation message as a string. Right now I'm logging that string to the system logs, which is fine for development, but I need to use that string inside the post updates message for clients to be able to see the confirmation. How can I do that? Is it possible?

I'm familiar with how to set custom messages for post updates using the post_updated_messages action hook. This question is slightly different.

I have a function/action hook on post_updated:

function my_custom_function($post_id) {
  $response = ping_other_service_and_get_confirmation($post_id);
  syslog(LOG_INFO, 'Response:' . $response['body']);
  return $response['body'];
}
add_action( 'post_updated', 'my_custom_function');

Assuming that the ping_other_service_and_get_confirmation() function pings some other web service, letting it know that the post has been updated, and returns a confirmation message as a string. Right now I'm logging that string to the system logs, which is fine for development, but I need to use that string inside the post updates message for clients to be able to see the confirmation. How can I do that? Is it possible?

I'm familiar with how to set custom messages for post updates using the post_updated_messages action hook. This question is slightly different.

I have a function/action hook on post_updated:

function my_custom_function($post_id) {
  $response = ping_other_service_and_get_confirmation($post_id);
  syslog(LOG_INFO, 'Response:' . $response['body']);
  return $response['body'];
}
add_action( 'post_updated', 'my_custom_function');

Assuming that the ping_other_service_and_get_confirmation() function pings some other web service, letting it know that the post has been updated, and returns a confirmation message as a string. Right now I'm logging that string to the system logs, which is fine for development, but I need to use that string inside the post updates message for clients to be able to see the confirmation. How can I do that? Is it possible?

1
source | link

How can I set a dynamic value for post_updated_messages based on return value of post_updated?

I'm familiar with how to set custom messages for post updates using the post_updated_messages action hook. This question is slightly different.

I have a function/action hook on post_updated:

function my_custom_function($post_id) {
  $response = ping_other_service_and_get_confirmation($post_id);
  syslog(LOG_INFO, 'Response:' . $response['body']);
  return $response['body'];
}
add_action( 'post_updated', 'my_custom_function');

Assuming that the ping_other_service_and_get_confirmation() function pings some other web service, letting it know that the post has been updated, and returns a confirmation message as a string. Right now I'm logging that string to the system logs, which is fine for development, but I need to use that string inside the post updates message for clients to be able to see the confirmation. How can I do that? Is it possible?