Ping IndexNow for newly 404ing URLs. #160
Merged
+38
−5
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.
Modifies the conditions under which IndexNow is pinged.
Why
In the event someone has accidentally published a page and then unpublished it, it's likely they wish to have the URL removed from search engines asap.
How
Replaces the check for
'publish' !== $new_status
with a check whether the old and new post statuses are publicly viewable.If both are not viewable no ping takes place as the URL will be an existing 404 response.
If one is viewable but the other is not, a ping takes place as the page has either being updated or unpublished.
As sites can have custom public post statuses, I've removed the hard coded
publish
status check asis_post_status_viewable()
will cover a wider range of statuses, includingpublish
.No ping takes place for non-viewable post types as the it shouldn't change without developer intervention, at which point they are responsible for the SEO impacts of the change.
For item 2: Bypass pinging if
'1' == $_GET['meta-box-loader']
Fixes #158.