I am working on a plugin, but add_action doesn't call the callback. The code is as follows:
require plugin_dir_path( __FILE__ ) . 'includes/class-network.php';
$distro = new Classnetwork();
includes/class-network.php:
class Classnetwork {
public function __construct() {
add_action( 'publish_post', array ($this, 'cdn_capture_data') );
}
public function cdn_capture_data( $post_id, $post ) {
print_r ($post);
}
}
Nothing is printed, not error, it just doesn't do anything every time I post a new post. Any ideas where is the error? The __construction is called but not the callback from add_action.