Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with getting RAW format of excerpt in WPGraphQL using Apollo

When I try to get an excerpt from WPGraphQL plugin and pass excerpt(format: RAW) in the query, it's working fine in the WPGraphiQL window, but when I'm executing the same query in Vue Apollo it's always returning null.

Here is my code:

apollo: {
    posts: gql`
        query {
          posts {
            nodes {
              title
              uri
              date
              databaseId
              featuredImage {
                sourceUrl
              }
              excerpt(format: RAW)
            }
          }
        }
      `
  },

Am I guessing right that it has to deal with enum type on the server-side and the way it's passed in Apollo query string? Also when I pass only excerpt without argument it returns excerpt with HTML tags, so... what's wrong?

like image 457
mihauke Avatar asked Dec 06 '25 07:12

mihauke


1 Answers

Use excerpt(format: FORMATTED)

and use in html like this:

dangerouslySetInnerHTML={{ __html: node.excerpt }}
like image 78
Zakir Hossain Avatar answered Dec 08 '25 20:12

Zakir Hossain