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

Add hook to filter WP_Query args for get_pull_content REST endpoint #839

Merged
merged 1 commit into from
Feb 1, 2022
Merged

Add hook to filter WP_Query args for get_pull_content REST endpoint #839

merged 1 commit into from
Feb 1, 2022

Conversation

theskinnyghost
Copy link
Member

Description of the Change

This PR introduces a new hook which can be used to filter the arguments used by WP_Query in the distributor/list-pull-content REST API endpoint (based on existing hook provided by WP core, see rest_this-post_type_query).

This can be useful to filter down the content when users have already pulled content from a connection.

Alternate Designs

N/A

Possible Drawbacks

I guess there could be a possible negative performance impact if a developer doesn't use the filter properly (e.g. setting posts_per_page to -1).

Verification Process

I did add a custom mu-plugin plugin to my WP install with the following code and was able to change the results for the WP_Query.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

Added - New hook to filter WP_Query args for the list-pull-content REST endpoint

@dkotter dkotter self-requested a review February 1, 2022 20:02
@dkotter dkotter added this to the 1.7.0 milestone Feb 1, 2022
@dkotter dkotter merged commit cbf574d into 10up:develop Feb 1, 2022
@jeffpaul jeffpaul modified the milestones: 1.7.0, 1.6.8 Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants