-
I’m using the follow script to no-index job offers that get expired.
add_filter('rank_math/frontend/robots', function ($robots) {
if (is_singular('job')) {
$job = wpjb_get_object_from_post_id(get_the_ID(), 'job');if ($job && $job->expired()) {
// Adiciona 'noindex' ao array de diretivas meta robots
$robots = array_diff($robots, array('index'));
$robots[] = 'noindex';
}
}return $robots;
});And it actually put’s the page with no-index, but it doesn’t get removed from the sitemap. When I edit the page, it shows ‘index’ in the rankmath (perhaps, it’s noindex in the reality) gutenberg feature – what can I do to improve the code?
The ticket ‘Help with no-index function :)’ is closed to new replies.