aacssh
Forum Replies Created
-
Forum: Plugins
In reply to: [JSON API] specify posts to be pulled by categoryWe can’t filter posts or custom post type data even by category, is it?
Forum: Plugins
In reply to: [WordPress REST API (Version 2)] Get meta data of a custom post typeI 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
In reply to: [WordPress REST API (Version 2)] Get meta data of a custom post typeHi 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
Also how to change the limit of listing only 10 posts so we can get more posts at a time. Thank you
We updated to 2.0 Beta 11 but we are still receiving the error, just line no changed from 1226 to 1236
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
In reply to: [WP Bootstrap Gallery] Can't upload imagesI just deactivated the plugin and re-activated again. Now it’s working fine. Thank you for this awesome plugin