Hello,
The reason you see the noindex meta tag is because your main Events page is set as a calendar view.
You can try adding the following snippet instead to your theme’s functions.php file to remove the noindex from your calendar page:
https://theeventscalendar.com/support/forums/topic/noindex-on-default-events-page-how-to-remove/
If that doesn’t work, can you try the following snippet in your functions.php file as well:
add_filter( ‘tribe_events_add_no_index_meta’, ‘__return_false’ );
Let me know if that helps!
Regards,
Marho
I’ve added all of this. Will it work?
add_action(‘wp_head’, ‘kill_tribe_noindex’, 1);
function kill_tribe_noindex() {
remove_action(‘wp_head’, array(TribeEvents::instance(), ‘noindex_months’));
}
if ( class_exists( ‘Tribe__Events__Main’ ) ) {
add_action( ‘wp’, ‘remove_tribe_noindex’, 999 );
function remove_tribe_noindex() {
remove_action( ‘wp’, array( ‘Tribe__Events__Main’, ‘issue_noindex’ ) );
}
}
add_filter( ‘tribe_events_add_no_index_meta’, ‘__return_false’ );
Hi @fupfac,
I tried checking a single event page URL and I don’t think the code worked. Perhaps because of incorrect syntax. Could you kindly try replacing it all with the following,
add_action('wp_head', 'kill_tribe_noindex', 1);
function kill_tribe_noindex() {
remove_action('wp_head', array(TribeEvents::instance(), 'noindex_months'));
}
if ( class_exists( 'Tribe__Events__Main' ) ) {
add_action( 'wp', 'remove_tribe_noindex', 999 );
function remove_tribe_noindex() {
remove_action( 'wp', array( 'Tribe__Events__Main', 'issue_noindex' ) );
}
}
add_filter( 'tribe_events_add_no_index_meta', '__return_false' );
Let me know if this helps.
Kind regards,
Masood