Ho Ho Ho! It’s December now so you get a Santa-style greeting from me! Today I’ll be showing you a simple trick that I got asked a while back ago in one of the comments, that is: “how can we display excerpt to the more tag (<!–more–>) with WP API V2”?
By default, WP API V2 has the
excerpt field in the posts response, but the auto generated one is often not what we want.
So here are things we’d like to hack around the WP API and get the results we want:
- Get the excerpt with read more link
- Get the excerpt from text before the more tag
- Display content of the shortcodes or oEmbed links in your excerpt
Now let’s get started.