Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
¿Qué causa la falla al mostrar el nombre del autor de las publicaciones de la API de WordPress en una vista de manillares?

Estoy trabajando en hacer un blog usando WordPress como un CMS sin cabeza y Express Handlebars para las vistas.

En el controlador tengo:

 var axios = require('axios'); /* GET home page data */ exports.getHomepageData = async (req, res, next) => { try { let [postCaregoriesData, postData] = await Promise.all([ axios.get(`${base_url}/categories`), axios.get(`${base_url}/posts?_embed`), ]); const posts = postData.data; const categories = postCaregoriesData.data; posts.forEach(function(post){ console.log(post._embedded.author[0].name); }); res.render('index', { layout: 'layout', pageTitle: 'All posts', categories: categories, posts: posts, }); } catch (error) { res.status(500).json(error); } };

Esta línea muestra el nombre del autor en la terminal:

 posts.forEach(function(post){ console.log(post._embedded.author[0].name); });

Sin embargo, en la vista, donde muestro con éxito el título de la publicación, uso esto para mostrar el nombre del autor de la publicación:

 {{#each posts}} {{this._embedded.author[0].name}} {{/each}}

Esto falla con el error:

 Expecting 'ID', got 'INVALID'

¿Qué le falta al código?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!