Title: Plugin throws error
Last modified: September 7, 2023

---

# Plugin throws error

 *  [Ananda Kannan S P](https://wordpress.org/support/users/dezvolta/)
 * (@dezvolta)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/plugin-throws-error-4/)
 * Hi Richard
 * We are using this snippet to get sub page by slug something like wp-json/wp/v2/
   pages?path=/parent-slug/child-slug
 *     ```wp-block-code
       add_filter('rest_page_query', function ($args, $request){
       $path = $request->get_param('path');
       if (!empty($path)) {
       $pageByPath = get_page_by_path($path, OBJECT, 'page');
       // overwrite the page id with the page id by path
       $args['p'] = $pageByPath->ID;
       }
       return $args;
       }, 10, 2);
       ```
   
 * When we install your plugin it throws error.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * (@rockfire)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/plugin-throws-error-4/#post-17041509)
 * Hi [@dezvolta](https://wordpress.org/support/users/dezvolta/)
 * Thank you for using our plugin!
   I just did a test on a clean WordPress install
   with your code snippet and our plugin. I didn’t get any error. Can you tell me
   what error you got?

Viewing 1 replies (of 1 total)

The topic ‘Plugin throws error’ is closed to new replies.

 * ![](https://ps.w.org/wp-rest-cache/assets/icon-256x256.png?rev=3328849)
 * [WP REST Cache](https://wordpress.org/plugins/wp-rest-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-rest-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-rest-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-rest-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-rest-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-rest-cache/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * Last activity: [2 years, 8 months ago](https://wordpress.org/support/topic/plugin-throws-error-4/#post-17041509)
 * Status: not resolved