| 4636 | /** |
| 4637 | * Disallow crawling of particular pages for certain conditions. |
| 4638 | * |
| 4639 | * This function runs as a filter on option_blog_public. When the disallow_crawling |
| 4640 | * filter returns true, the blog_public option will be set to 0 for the duration of the |
| 4641 | * active request. blog_public is set to 0 only if it is currently set to 1. This avoids |
| 4642 | * stomping custom values used by plugins. |
| 4643 | * |
| 4644 | * @param int $blog_public The current value of the blog_public option |
| 4645 | * @return int The new blog_public value. |
| 4646 | */ |
| 4647 | function _maybe_disallow_crawling( $blog_public ) { |
| 4648 | // By default, disallow crawling of replytocom requests. |
| 4649 | $disallow = isset( $_GET['replytocom'] ) ? true : false; |
| 4650 | |
| 4651 | $disallow = apply_filters( 'disallow_crawling', $disallow ); |
| 4652 | |
| 4653 | if ( ! $disallow ) |
| 4654 | return $blog_public; |
| 4655 | |
| 4656 | return ( 1 !== (int) $blog_public ) ? $blog_public : 0; |
| 4657 | } |
| 4658 | |