Created
April 16, 2020 12:07
-
-
Save mcfarlan/202b4f813cae453d2a62eb9550acb5c5 to your computer and use it in GitHub Desktop.
Add this to your functions.php file, at the bottom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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