publish_post action hook doesn’t give post_meta_data
If the wp_send_json() function is sending the right data, but for some reason you want to use another function to actually send the JSON data, then you can use wp_json_encode(). This is basically the only thing that wp_send_json() does before sending off the data. add_action( ‘publish_post’, ‘wpse_228607_publish_post’, 10, 2 ); function wpse_228607_publish_post( $post_id, $post ){ … Read more