Looks like the Yoast SEO plugin is causing the add_filter($the_content, ‘errorcode_post’) not to work properly. It calls the errorccode_post function but doesn’t pass the_content to the function, hence none of my additions to the content were not showing up. Not sure what I am doing wrong but disabling the yoast plugin fixes it.