Issue-1154: Add Support for Handling Deleted Articles #1159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for handling scenarios where the Apple News API reports that an article does not exist anymore, by removing the associated metadata in WordPress. This aims to prevent error messages from being thrown when information on deleted articles is requested. Fixes #1154
Description
Implemented a check to remove the "Publish to Apple News" postmeta data in WordPress when the News API returns a 404 error code, indicating that the article does not exist. This ensures that WordPress does not continue to attempt fetching data for articles that have been deleted from Apple News.
Use Case
This functionality is particularly useful when a post is deleted directly in iCloud News Publisher but still exists in WordPress. With this update, the postmeta in WordPress will be automatically updated to reflect the deletion, based on the News API's response, thus avoiding unnecessary fetch requests and error messages.
Acceptance Criteria
Testing Instructions