Title: aacssh's Replies | WordPress.org

---

# aacssh

  [  ](https://wordpress.org/support/users/aacssh/)

 *   [Profile](https://wordpress.org/support/users/aacssh/)
 *   [Topics Started](https://wordpress.org/support/users/aacssh/topics/)
 *   [Replies Created](https://wordpress.org/support/users/aacssh/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/aacssh/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/aacssh/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/aacssh/engagements/)
 *   [Favorites](https://wordpress.org/support/users/aacssh/favorites/)

 Search replies:

## Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[JSON API] specify posts to be pulled by category](https://wordpress.org/support/topic/specify-posts-to-be-pulled-by-category/)
 *  [aacssh](https://wordpress.org/support/users/aacssh/)
 * (@aacssh)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/specify-posts-to-be-pulled-by-category/#post-6986800)
 * Have you tried this.
 * [http://some.example/api/get_category_posts/?slug=category-slug&post_type=post-type&count=no-of-post-to-retrieve](http://some.example/api/get_category_posts/?slug=category-slug&post_type=post-type&count=no-of-post-to-retrieve)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WordPress REST API (Version 2)] Filter custom post type's data by category name or custom taxonomy and it's term](https://wordpress.org/support/topic/filter-custom-post-types-data-by-category-name-or-custom-taxonomy-and-its-term/)
 *  Thread Starter [aacssh](https://wordpress.org/support/users/aacssh/)
 * (@aacssh)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/filter-custom-post-types-data-by-category-name-or-custom-taxonomy-and-its-term/#post-6997809)
 * We can’t filter posts or custom post type data even by category, is it?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WordPress REST API (Version 2)] Get meta data of a custom post type](https://wordpress.org/support/topic/get-meta-data-of-a-custom-post-type/)
 *  Thread Starter [aacssh](https://wordpress.org/support/users/aacssh/)
 * (@aacssh)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/get-meta-data-of-a-custom-post-type/#post-6998076)
 * I did register in res_api_init hook and the routes is now available but we are
   getting 401 unauthorized error.
 *     ```
       {
         "code": "rest_forbidden",
         "message": "Sorry, you cannot view the meta for this post.",
         "data": {
           "status": 401
         }
       }
       ```
   
 * User should be logged in to access this route? If yes, then how to make it available
   for public. Thank you.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WordPress REST API (Version 2)] Get meta data of a custom post type](https://wordpress.org/support/topic/get-meta-data-of-a-custom-post-type/)
 *  Thread Starter [aacssh](https://wordpress.org/support/users/aacssh/)
 * (@aacssh)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/get-meta-data-of-a-custom-post-type/#post-6998060)
 * Hi Daniel,
 * Thanks for you reply. I have one question though. Where to put this code
 *     ```
       $meta_controller = new WP_REST_Meta_Posts_Controller( 'my-post-type' );
       $meta_controller->register_routes();
       ```
   
 * I added the code in functions.php inside the following function
 *     ```
       add_action( 'init', 'my_custom_post_type_rest_support', 25 );
       function my_custom_post_type_rest_support() { }
       ```
   
 * but got following error
 * `Fatal error: Call to a member function register_route() on null in /wp-includes/
   rest-api.php on line 69`
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WordPress REST API (Version 2)] Filter custom post type's data by category name or custom taxonomy and it's term](https://wordpress.org/support/topic/filter-custom-post-types-data-by-category-name-or-custom-taxonomy-and-its-term/)
 *  Thread Starter [aacssh](https://wordpress.org/support/users/aacssh/)
 * (@aacssh)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/filter-custom-post-types-data-by-category-name-or-custom-taxonomy-and-its-term/#post-6997489)
 * Also how to change the limit of listing only 10 posts so we can get more posts
   at a time. Thank you
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WordPress REST API (Version 2)] Object of class WP_Error could not be converted to string](https://wordpress.org/support/topic/object-of-class-wp_error-could-not-be-converted-to-string-3/)
 *  Thread Starter [aacssh](https://wordpress.org/support/users/aacssh/)
 * (@aacssh)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/object-of-class-wp_error-could-not-be-converted-to-string-3/#post-6993887)
 * We updated to 2.0 Beta 11 but we are still receiving the error, just line no 
   changed from 1226 to 1236
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WordPress REST API (Version 2)] Object of class WP_Error could not be converted to string](https://wordpress.org/support/topic/object-of-class-wp_error-could-not-be-converted-to-string-3/)
 *  Thread Starter [aacssh](https://wordpress.org/support/users/aacssh/)
 * (@aacssh)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/object-of-class-wp_error-could-not-be-converted-to-string-3/#post-6993770)
 * This is the code we used in functions.php to register our custom post type for
   the REST API.
 *     ```
       /**
       * Add REST API support to an already registered post type.
       */
       add_action( 'init', 'my_custom_post_type_rest_support', 25 );
       function my_custom_post_type_rest_support() {
         global $wp_post_types;
   
         //be sure to set this to the name of your post type!
         $post_type_name = 'custom-post-type';
         if( isset( $wp_post_types[ $post_type_name ] ) ) {
           $wp_post_types[$post_type_name]->show_in_rest = true;
           $wp_post_types[$post_type_name]->rest_base = $post_type_name;
           $wp_post_types[$post_type_name]->rest_controller_class = 'WP_REST_Posts_Controller';
         }
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Bootstrap Gallery] Can't upload images](https://wordpress.org/support/topic/cant-upload-images-104/)
 *  Thread Starter [aacssh](https://wordpress.org/support/users/aacssh/)
 * (@aacssh)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/cant-upload-images-104/#post-5633514)
 * I just deactivated the plugin and re-activated again. Now it’s working fine. 
   Thank you for this awesome plugin

Viewing 8 replies - 1 through 8 (of 8 total)