title: Where to register REST route to wordpress plugin endpoint
body: <p>Where must the registration function go? (<code>register_rest_route()</code>)</p>
  <ul>
  <li>Must it be in theme/child functions.php?</li>
  <li>Or can it be in the plugin base php file? (e.g. \wp-content\plugins\example\example.php)</li>
  </ul>
  <p>Is there any documentation that clarifies this?</p>
  <p>It is not mentioned in the official documentation at:
  <a href="https://developer.wordpress.org/rest-api/extending-the-rest-api/routes-and-endpoints/" rel="nofollow noreferrer">https://developer.wordpress.org/rest-api/extending-the-rest-api/routes-and-endpoints/</a></p>
  <p>Similarly, where must the endpoint function be stored? The registration function only names it, without specifying its path.</p>
  <p>For example, can you do like this:</p>
  <ul>
  <li>Registration function call (<code>register_rest_route</code>) goes in main plugin file (e.g. \wp-content\plugins\example\example.php)</li>
  <li>Endpoint function is in some other plugin file (e.g. \wp-content\plugins\example\sub-path-stuff\example-controller.php)</li>
  </ul>
  <p>If so, how?</p>
  <p>The following link appears to attempt this but does not specify these attributes (e.g. \wp-content\plugins\example\example.php)</p>