I am trying to integrate a BroadBean (Job feed) plugin that imports jobs using an endpoint. We currently have this plugin installed on a staging site to set it up and troubleshoot issues first.
I have been investigating the issue of why the endpoint: /jobrelay/jobfeed/ is not returning JSON data and is being intercepted by our Roots theme and is rendering the wp_head() markup which is not what is intended. It is assumed that the framework interprets this page as a WP template and attempts to render the page with HTML.
Switching over to the 2022 WP theme returns this endpoint as JSON.
I also used a fresh install of the Roots theme, disabled all other plugins, and re-installed the WP database and the same issue occurred.
On further investigation, we inspected the Job Feed plugin code (which is very well commented) and discovered that the endpoints.php file uses a WP function: add_rewrite_endpoint() to build this URI. We have been told not to modify the plugin as we will obviously not be able to update it with future releases.
Is there a way to ensure that this specific route (/jobrelay/jobfeed/ ) is not interpreted as a template by Roots and we force it to return JSON data only?
If that is the case, then you might be able to resolve your problem by either unhooking Acorn from that filter when you know you’re running on that endpoint, or by intercepting the filter once Sage is done with it, and returning whatever correct data you want to return.