what is correct way to hook when update post

i try to hook when post is updated but all hook i try never executed except updated_post_meta add_action(‘updated_post_meta’, ‘my_function’); function my_function($post_id) { echo ‘This is my post ID : ‘.$post_id; } I’ve tried this add_action(‘save_post’, ‘my_function’); but no id was echo out, or maybe this message already echo but never renders because of redirect header … Read more

add_action reference a class

Is it possible to reference a class instead of a function in ‘add_action’? Can’t seem to figure it out. Here is just a basic example of the function in question. add_action( ‘admin_init’, ‘MyClass’ ); class MyClass { function __construct() { .. This is where stuff gets done .. } } So yeah, that doesn’t work. … Read more

Passing a parameter to filter and action functions

Is a way to pass my own parameters to the function in add_filter or add_action. For example take a look in the following code: function my_content($content, $my_param) { do something… using $my_param here … return $content; } add_filter(‘the_content’, ‘my_content’, 10, 1); Can I pass my own parameter? something like: add_filter(‘the_content’, ‘my_content($my_param)’, 10, 1) or add_filter(‘the_content’, … Read more