Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Pods fields in REST API as params for meta query #7211

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JoryHogeveen
Copy link
Member

@JoryHogeveen JoryHogeveen commented Oct 30, 2023

Description

This PR will add basic support for meta based REST API queries when passing Pods fields as parameters.

Related GitHub issue(s)

Fixes #7210

Testing instructions

  1. Create CPT (or use Post)
  2. Add a custom field
  3. Enable REST API
  4. Query field: example.com/wp-json/wp/v2/{CPT}?{FIELDNAME}={VALUE}

Changelog text for these changes

PR checklist

@JoryHogeveen JoryHogeveen added Type: Feature Features that add entirely new functionality that was not there before Type: Enhancement Enhancements to features that already exist, but are not major additions Status: PR > Pending Code Review PR is pending code review by core developers Component: REST API Issues related to the Pods REST API endpoints or integration with existing WP REST API endpoints Status: PR > QA pending QA needs to be done labels Oct 30, 2023
@JoryHogeveen JoryHogeveen added this to the Pods 3.0.9 milestone Oct 30, 2023
@JoryHogeveen JoryHogeveen self-assigned this Oct 30, 2023
@JoryHogeveen JoryHogeveen changed the title Feature/7210 rest api query Support Pods fields in REST API as params for meta query Oct 30, 2023
@what-the-diff
Copy link

what-the-diff bot commented Oct 30, 2023

PR Summary

  • Introduction of the query_fields function in PodsRESTFields class
    This modification brings in a new function called query_fields. This function comes in handy in refining the parameters for a REST request depending on the field values given. In simpler terms, it curtails through unnecessary data in a request, helping the program to process only the specific, relevant pieces of information.

  • Inclusion of a filter hook named rest_{pod_name}_query
    Another function called rest_{pod_name}_query has been introduced, which allows us to apply the above query_fields function to a specific category (or 'pod' in programming language). Essentially, it provides a way for integrating the filtering feature with specific parts of our system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: REST API Issues related to the Pods REST API endpoints or integration with existing WP REST API endpoints Status: PR > Pending Code Review PR is pending code review by core developers Status: PR > QA pending QA needs to be done Type: Enhancement Enhancements to features that already exist, but are not major additions Type: Feature Features that add entirely new functionality that was not there before
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

Support meta fields in REST API query params
2 participants