All_in_One_SEO_Pack_Front

Class All_in_One_SEO_Pack_Front.

Defined (1)

The class is defined in the following location(s).

/public/front.php  
  1. class All_in_One_SEO_Pack_Front { 
  2.  
  3. /** 
  4. * All_in_One_SEO_Pack_Front constructor. 
  5. */ 
  6. public function __construct() { 
  7.  
  8. add_action( 'template_redirect', array( $this, 'noindex_follow_rss' ) ); 
  9. add_action( 'template_redirect', array( $this, 'redirect_attachment' ) ); 
  10.  
  11.  
  12. /** 
  13. * Noindex and follow RSS feeds. 
  14. * @Since 2.3.6 
  15. */ 
  16. public function noindex_follow_rss() { 
  17. if ( is_feed() && headers_sent() === false ) { 
  18. header( 'X-Robots-Tag: noindex, follow', true ); 
  19.  
  20. /** 
  21. * Redirect attachment to parent post. 
  22. * @since 2.3.9 
  23. */ 
  24. function redirect_attachment() { 
  25.  
  26. global $aioseop_options; 
  27. if ( ! isset( $aioseop_options['aiosp_redirect_attachement_parent'] ) || $aioseop_options['aiosp_redirect_attachement_parent'] !== 'on' ) { 
  28. return false; 
  29.  
  30. global $post; 
  31. if ( is_attachment() && ( ( is_object( $post ) && isset( $post->post_parent ) ) && ( is_numeric( $post->post_parent ) && $post->post_parent != 0 ) ) ) { 
  32. wp_safe_redirect( get_permalink( $post->post_parent ), 301 ); 
  33. exit;