Automattic / Automattic/jetpack
Related Posts endpoint called on Add Post
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
When a user creates a new Post via the WP-Admin it triggers a call to the Related Posts endpoint which fails as the has not been created.
#### Steps to reproduce the issue
1. Install and Activate Query Monitor Plugin
2. Activate Related Posts Module of Jetpack
3. Click on Posts > Add New
4. View HTTP API Calls in Query Monitor
5. A call for related posts will have been made and returns 400
https://public-api.wordpress.com/rest/v1/sites/XXX/posts/YYY/related/
#### What I expected
Related Posts should not be triggered when creating a new post as no context exists to relate posts on.
#### What happened instead
A call to the related posts endpoint occurred for the new empty post
---
Note this is an existing error and not related to recent releases. There is no end user impact as saving as draft or publish of the posts will cause data to be persisted via sync and endpoint will return related posts.
Contributor guide
Research direction
Start by inspecting the Related Posts module's request path when opening WP-Admin's Add New Post, then reproduce it with Query Monitor and check the related posts endpoint call. Done means no related posts request is made for a new, unsaved post, while existing saved posts continue to request related posts normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100