Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
spelkey-ucd committed Sep 27, 2023
1 parent 452d798 commit 83ccb59
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions theme/includes/classes/site.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,22 @@ public function __construct() {
add_filter( 'timber/user/class', array( $this, 'extend_user' ), 10, 2 );
add_filter( 'timber/post/classmap', array($this, 'extend_post'), 4 );
add_filter( 'post_type_labels_post', array($this, 'change_post_labels') );
add_filter( 'wp_robots', [$this, 'robots_noindex'], 101 );

parent::__construct();
}

/**
* @description Adds noindex to 404 and search pages
*/
public function robots_noindex($robots){
if ( is_404() || is_search() ) {
$robots['noindex'] = true;
$robots['nofollow'] = true;
}
return $robots;
}

public function extend_user($class, \WP_User $user){
return UcdThemeUser::class;
}
Expand Down

0 comments on commit 83ccb59

Please sign in to comment.