I have a function that fetches all the latest posts which works fine. But i wish to fetch only the posts that have a specific value from a custom option.

enter image description here

But adding the meta_key/meta_value does not change anything, i still get the latest blog posts regardless of those values added.

getLatestPosts (count = 4){
        return this.get("posts", {
            context: "embed",
            per_page: count.toString(10),
            _embed: "",
            meta_key: "_bunyad_featured_post",
            meta_value: "1"

Am i using the wrong query options for this? Or do i need to add something for that custom post option to be usable through the Rest Api?

  • have you registered your post meta on the PHP side? Or is it raw unregistered post meta? Where does the .get method come from? Note that querying for posts via their post meta values is more expensive/slower, it would be faster/more efficient to have used a custom taxonomy for grouping posts into featured and non-featured, be that via a dedicated "featured" custom taxonomy, or via a more general utility taxonomy, this could in the best case scenario be as much as 1000x faster
    – Tom J Nowell
    Commented Aug 1, 2023 at 15:00

1 Answer 1


The documentation for the posts endpoint does not indicate that meta_key or meta_value are accepted parameters.

You will likely have most success by defining your own endpoint to accept those parameters.

This question may be helpful: REST API and filtering by meta value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.