[Twenty Twelve] Hide post dates from Google SERP?
-
I’m using a child theme, with Twenty Twelve as the parent. For SEO reasons, I need to prevent Google from showing my post dates alongside the meta description in search results. With my previous theme, I had post dates wrapped in Javascript, which did the trick ( as seen here: https://www.andrewkeir.com/remove-wordpress-post-datestamp-timestamp-google-serps/ ). Twenty Twelve, however, processes dates differently, and I’m stuck on what to do. I’m not trying to remove the dates completely. I still want my readers to see them when they’re on the site; I just want to hide them from Google.
I’m guessing the answer lies in my functions.php file, and has something to do with this:
$date = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a>', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) );
But I’m stuck on how to get the same effect. Any help would be appreciated.
Also, to achieve this in Twenty Twelve, is it enough to just edit that one file? Previously, I had to edit my index.php, single.php, etc.
- The topic ‘[Twenty Twelve] Hide post dates from Google SERP?’ is closed to new replies.