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

How To: Cron Job to Publish Articles #1143

Open
timatron opened this issue Jul 1, 2024 · 1 comment
Open

How To: Cron Job to Publish Articles #1143

timatron opened this issue Jul 1, 2024 · 1 comment

Comments

@timatron
Copy link

timatron commented Jul 1, 2024

Description

We are finding lots of errors with automatic publishing of articles to Apple News almost always we see this error: NOT_FOUND (keyPath articleId)

What is the best way to setup a cron job to publish any articles articles published within X timeframe? I found the apple_news_async_push hook, but its unclear how to prep articles to publish and publish them with this action.

Is there any documentation or guidance on this?

Thanks,
Tim

@kevinfodness
Copy link
Member

Async is deprecated and I don't advise that you use it.

If you're seeing NOT_FOUND that means that it's trying to update, not create, and the Apple News API is telling you that it can't find the article ID you're trying to update. If that's the case, then a cron job to publish articles isn't going to help you, because you'll get the same error.

For the posts that are failing, take a look in the postmeta table and see if there's an Apple News article ID, then try to find the corresponding ID in iCloud News Publisher - I bet it isn't there.

The most common way this situation occurs is when using a plugin to make a copy of a post, where it copies the postmeta in addition to the values in the posts table, and it makes a copy of the Apple News postmeta as well, including the article ID. If the article ID was deleted via iCloud News Publisher and not through WordPress, then the meta for the article ID would still be intact on the original post, and making a copy of that post and trying to publish it would result in the exact scenario you're describing. Maybe this was the case for a post that you're using as a template?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants