Hello @catherinek
Thank you for contacting the support and please accept our apologies for missing your support topic and thus the delayed response.
Please try adding the following code in your theme’s functions.php file to create a redirection rule when a post is trashed:
add_action( 'wp_trash_post', function( $post_id ){
$sources[] = [
'pattern' => get_the_permalink( $post_id ),
'comparison' => 'exact',
];
$args = [
'sources' => $sources,
'url_to' => '',
'header_code' => '410',
];
RankMath\Redirections\DB::add( $args );
});
Please let us know if that helps.
Hello @catherinek
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://ww.wp.xz.cn/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.