Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add a noindex meta tag to expired Event Espresso 4 events. Useful for SEO.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_add_tagseo_meta() {
if ('espresso_events' == get_post_type() && is_single() ){
$id = get_the_id();
$event = EEH_Event_View::get_event( $id );
$status = $event instanceof EE_Event ? $event->get_active_status() : '';
if ( $status == 'DTE' ) {
?>
<meta name="robots" content="noindex">
<?php
}
}
}
add_action( 'wp_head', 'ee_add_tagseo_meta', 9 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.