Skip to content

Instantly share code, notes, and snippets.

@mcfarlan
Created April 16, 2020 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcfarlan/202b4f813cae453d2a62eb9550acb5c5 to your computer and use it in GitHub Desktop.
Save mcfarlan/202b4f813cae453d2a62eb9550acb5c5 to your computer and use it in GitHub Desktop.
Add this to your functions.php file, at the bottom
function filter_document_title( $title ) {
if ( is_home() && ! is_archive() ) {
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$title = 'TorrentFreak News - Page ' . $paged;
}
return $title;
}
add_filter( 'pre_get_document_title', __NAMESPACE__ . '\\filter_document_title', 30 );
function tf_yoast_seo_robots_remove_archives( $robots ) {
if ( ( is_post_type_archive() || is_archive() ) && ! is_date() && ! is_home() ) {
$new_meta = 'noindex, nofollow';
$robots = $new_meta;
}
return $robots;
}
add_filter( 'wpseo_robots', __NAMESPACE__ . '\\tf_yoast_seo_robots_remove_archives' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment