API REST: filtro por idioma en /wp/v2/animals (?lang=es|eu)
- Polylang gratuito no filtra la API REST por idioma: el parámetro «lang» se pasa a la consulta. - MCP: list_animals descarta además las fichas de otro idioma (funciona aunque WordPress aún no esté actualizado). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -74,7 +74,7 @@ export function createBilagunServer({ api, publicUrl, remote = false }) {
|
||||
params.set('status', includeDrafts ? 'publish,draft,pending' : 'publish');
|
||||
if (search) params.set('search', search);
|
||||
if (species) params.set('species', String(await speciesId(species, language)));
|
||||
let animals = (await api(`/wp/v2/animals?${params}`)).map(summary);
|
||||
let animals = (await api(`/wp/v2/animals?${params}`)).map(summary).filter((a) => a.language === language);
|
||||
if (status) animals = animals.filter((a) => a.profile?.status === status);
|
||||
return animals.map(({ id, name, wpStatus, profile, translationOf }) => ({ id, name, wpStatus, status: profile?.status, featured: profile?.featured, age: profile?.labels?.age, translationOf }));
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user