Title: File in theme can break core plugin functionality
Last modified: August 22, 2016

---

# File in theme can break core plugin functionality

 *  [mwidmann](https://wordpress.org/support/users/mwidmann/)
 * (@mwidmann)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/file-in-theme-can-break-core-plugin-functionality/)
 * Or at least make the admin interface unusable.
 * Let’s say your installed and activated theme has a file called `widgets.php` 
   in its root folder at `get_stylesheet_directory()`.
 * If that is the case JSON_API’s `controller_path($controller)` function returns
   the path to the file located in the theme folder even though it might not be 
   a valid JSON_API Plugin.
 * For the time being I fixed it by using the same test as in `check_directory_for_controllers()`
   and patching line 360 of `wp-content/plugins/json-api/singletons/api.php’ as 
   follows:
 *     ```
       if (file_exists($theme_path) && preg_match("/class\s+JSON_API_{$controller}_Controller/i", file_get_contents($theme_path))) {
       ```
   
 * Would be great if this issue could be fixed.
 * Thank you.
 * [https://wordpress.org/plugins/json-api/](https://wordpress.org/plugins/json-api/)

The topic ‘File in theme can break core plugin functionality’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/json-api.svg)
 * [JSON API](https://wordpress.org/plugins/json-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-api/)
 * [Active Topics](https://wordpress.org/support/plugin/json-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-api/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [mwidmann](https://wordpress.org/support/users/mwidmann/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/file-in-theme-can-break-core-plugin-functionality/)
 * Status: not resolved