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

184
Views
What causes the failure to display the posts author name from the WordPress API in a Handlebars view?

I am working on making a blog using WordPress as a headless CMS and Express Handlebars for the views.

In the controller I have:

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);
  }
};

This line displays the autor's name in the terminal:

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

In the view however, where I sucesfully display the post title, I use this to dysplay the post author name:

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

This fails with the error:

Expecting 'ID', got 'INVALID'

What is missing from the code?

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!