Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
1

That filter is actually dynamic, so you'll just need to append your post type: add_filter( 'rest_prepare_projects', 'chrest_adjacent_posts', 10, 3 ); https://github.com/WP-API/WP-API/blob/develop/lib/endpoints/class-wp-rest-posts-controller.php#L1355 Hope that helps!!!


1

This question is a follow up of this question you asked earlier. Here we handled getting count per posttype. So you have all data, just not sorted correctly. Looking at your code you have one big problem. Getting and formatting data is done at the same time as you are outputting the data. For maintainability (and readability) it is best to separate these as ...


1

I think I am understanding your correctly...If I'm way off, let me know! // Assuming ideas is an array and you are looking for ideas=>two $query = new WP_Query( array( // You can pass 'any' to post_type, but you get a hold of revisions, attachments, and menu_items. But I am not sure how many Custom Post Types you have ¯\_(ツ)_/¯ '...


1

What makes this annoying is that the count is a wp_term_taxonomy table. So the way to do this is a custom query: function wpse340250_term_count( WP_Term $term, $post_type) { $q_args = [ 'post_type' => $post_type, 'nopaging' => true, // no limit, pagination 'fields' => 'ids', // only return post id's instead of full ...


Only top voted, non community-wiki answers of a minimum length are eligible