카테고리 없음2023. 4. 28. 16:31

1. Archive Page with Yoast SEO

* 참고 : https://websamosa.com/how-to-noindex-category-in-yoast-seo/

* noindex, follow 처리됨

 

How to Noindex Category in Yoast SEO Plugin: Wordpress? - Websamosa

Table Of Content1 What is No-index Tag?2 No Index Each category3 No Index All Categories What is No-index Tag? No-index Tag is a Meta tag ... Read moreHow to Noindex Category in Yoast SEO Plugin: WordPress?

websamosa.com

 

2. Single Post with wpseo_robots filter

Filter: 'wpseo_robots' - Allows filtering of the meta robots output of Yoast SEO.
* 참고1 : https://github.com/Yoast/wordpress-seo/issues/387

 

Noindex all posts in category · Issue #387 · Yoast/wordpress-seo

Currently there is an option to set noindex for the category-page itself, but it isn't possible to set noindex for all posts in that category. Adding this to the category-settings seems like a usef...

github.com

add_filter( 'wpseo_robots', 'wpseo_robots' );
/**
 * Filter: 'wpseo_robots' - Allows filtering of the meta robots output of Yoast SEO.
 *
 * @param string $robotsstr The meta robots directives to be echoed.
 * @return string
 */
function wpseo_robots( $robotsstr ) {
	if ( is_single() && in_category( array( 23, 25 ) ) ) {
		return 'noindex,follow';
	}
	return $robotsstr;
}

 

3. RSS Feed에서 제외 처리

* 참고1 : How to Exclude Specific Categories from WordPress RSS Feed : https://www.wpbeginner.com/wp-tutorials/how-to-exclude-specific-categories-from-wordpress-rss-feed/

* 참고2 : https://www.wpexplorer.com/exclude-wordpress-category-feed/

 

How to Exclude Specific Categories from WordPress RSS Feed

Do you want to hide specific categories from your WordPress RSS feed? Learn how to easily exclude specific categories from WordPress RSS feed. (2 Simple Methods)

www.wpbeginner.com

// Exclude Category with ID 17 from RSS feed
function exclude_feed_category($query) {
	if ($query->is_feed) {
		$query->set('cat', '-17');
	}
	return $query;
}
add_filter('pre_get_posts', 'exclude_feed_category');

 

4. XML Sitemap & Google News에서 제외

- 불가. 하지만 1,2에서 noindex, nofollow 처리했기때문에 큰 의미없음.

5. 검색결과에서 제외

 

// Exclude specific categories from search result page of wordpess
function wpb_search_filter( $query ) {
	if ( $query->is_search && !is_admin() )
	$query->set('cat','-3339,-2415');
	return $query;
}
add_filter('pre_get_posts', 'wpb_search_filter');

 

 

Posted by cpu21