Hello,
We apologize for the issue you are facing. Thank you for your kind words about Rank Math and the IndexNow feature!
Currently, when you delete a page or change its status to something that indicates it is no longer available (like transitioning from Public to Future), Rank Math automatically handles the submission of that URL to IndexNow, notifying search engines that the content has been removed. This means that when you delete a post or page, Rank Math will submit the URL to IndexNow, which helps in quickly removing it from search engine results.
However, if you want to create a custom solution using PHP to trigger the IndexNow API for specific transitions, you would need to write a custom code snippet. Unfortunately, we do not have a predefined code snippet for this specific use case in our documentation. You might consider using WordPress hooks like transition_post_status
to detect when a post’s status changes and then call the IndexNow API accordingly.
If you need further assistance with this custom implementation, we recommend reaching out to a developer who can help you with the coding part.
If you have any more questions or need further clarification, please feel free to reply to this ticket, and a human agent from our support team will assist you further.
Thank you for raising this concern!
Sources:
How to Use IndexNow With Rank Math » Rank Math
This is an automated reply from Rank Math Support Bot. Your ticket has been assigned to a human agent and we will get back to you shortly.
I think, that this is not correct.
Can you proof that with code?
Since here the code only works for trash but nocht from
published to future
public function save_post( $post_id, $post ) {
// Check if already submitted.
if ( in_array( $post_id, $this->submitted, true ) ) {
return;
}
// Check if post status changed to publish or trash.
if ( ! in_array( $post->post_status, [ 'publish', 'trash' ], true ) ) {
return;
}
// If new status is trash, check if previous status was publish.
if ( 'trash' === $post->post_status && 'publish' !== $this->previous_post_status[ $post_id ] ) {
return;
}
if ( wp_is_post_revision( $post_id ) || wp_is_post_autosave( $post_id ) || ! empty( Helper::get_post_meta( 'lock_modified_date', $post_id ) ) ) {
return;
}
if ( ! Helper::is_post_indexable( $post_id ) ) {
return;
}
// Check if it's a hidden product.
if ( 'product' === $post->post_type && Helper::is_woocommerce_active() ) {
$product = wc_get_product( $post_id );
if ( $product && ! $product->is_visible() ) {
return;
}
}
Sitepress::get()->remove_home_url_filter();
$url = get_permalink( $post );
if ( 'trash' === $post->post_status ) {
$url = $this->previous_post_permalinks[ $post_id ];
}
Sitepress::get()->restore_home_url_filter();
/**
* Filter the URL to be submitted to IndexNow.
* Returning false will prevent the URL from being submitted.
*
* @param string $url URL to be submitted.
* @param WP_POST $post Post object.
*/
$send_url = $this->do_filter( 'instant_indexing/publish_url', $url, $post );
// Early exit if filter is set to false.
if ( ! $send_url ) {
return;
}
$this->api_submit( $send_url, false );
$this->submitted[] = $post_id;
}
Hello,
Thank you for your query and we are so sorry about the trouble this must have caused.
Rank Math currently submits URLs to IndexNow only when posts are published, updated, or moved to trash, and not when the status changes from publish → “future”.
Extending this behavior would require a heavy customization using custom methods, and this type of implementation is unfortunately outside the scope of our support.
Don’t hesitate to get in touch with us if you have any other questions.