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

Related Posts: Add the jetpack-related-posts field to WP REST API for any post type #10203

Closed
htdat opened this issue Sep 25, 2018 · 1 comment · Fixed by #13805
Closed

Related Posts: Add the jetpack-related-posts field to WP REST API for any post type #10203

htdat opened this issue Sep 25, 2018 · 1 comment · Fixed by #13805
Assignees
Labels
Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". [Feature] Related Posts [Feature] WP REST API [Pri] Low [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Milestone

Comments

@htdat
Copy link
Member

htdat commented Sep 25, 2018

Currently, we're adding the jetpack-related-posts field to the WP REST API response of default posts only.

Code reference:

public function rest_register_related_posts() {
register_rest_field( 'post',
'jetpack-related-posts',
array(
'get_callback' => array( $this, 'rest_get_related_posts' ),
'update_callback' => null,
'schema' => null,
)
);
}

Requests

  • It would be great if we can add a filter and support this for any post type.
  • Furthermore, we support Related Posts for any post type allowing access via WP REST API. I think we can check rest_api_allowed_post_types and automatically add this jetpack-related-posts field to JSON.

Concern

I am not sure how this affects the current work to bring Gutenberg to Jetpack. It may be reviewed by someone working on Gutenberg for Related Posts (or Jetpack in general).

Other notes

This idea comes from the support request 1434937-zen
Private convo - p1537778474000100-slack-jpop-support

@htdat htdat added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Related Posts [Pri] Low [Feature] WP REST API labels Sep 25, 2018
@htdat htdat changed the title Related Posts: Add the jetpack-related-posts filed to WP REST API for any post type Related Posts: Add the jetpack-related-posts field to WP REST API for any post type Nov 21, 2018
@stale
Copy link

stale bot commented May 20, 2019

This issue has been marked as stale. This happened because:

  • It has been inactive in the past 6 months.
  • It hasn’t been labeled `[Pri] Blocker`, `[Pri] High`.

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

@stale stale bot added the [Status] Stale label May 20, 2019
@matticbot matticbot added the Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". label May 20, 2019
@stale stale bot removed the [Status] Stale label May 20, 2019
@jeherve jeherve self-assigned this Oct 23, 2019
@jeherve jeherve added this to the 7.9 milestone Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". [Feature] Related Posts [Feature] WP REST API [Pri] Low [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants