MCPcopy Create free account
hub / github.com/9d8dev/next-wp / getPostsByCategory

Function getPostsByCategory

lib/wordpress.ts:248–252  ·  view source on GitHub ↗
(categoryId: number)

Source from the content-addressed store, hash-verified

246}
247
248export async function getPostsByCategory(categoryId: number): Promise<Post[]> {
249 return wordpressFetch<Post[]>("/wp-json/wp/v2/posts", {
250 categories: categoryId,
251 });
252}
253
254export async function getPostsByTag(tagId: number): Promise<Post[]> {
255 return wordpressFetch<Post[]>("/wp-json/wp/v2/posts", { tags: tagId });

Callers

nothing calls this directly

Calls 1

wordpressFetchFunction · 0.85

Tested by

no test coverage detected