• プラグイン「All in One SEO Pack」(以下aiospで略)を使用時404ページで下記の通りNoticeが表示されます。

    Notice: Undefined variable: post_type in /wp-content/plugins/all-in-one-seo-pack/aioseop_class.php on line 4154

    該当の箇所を調べてみると$post_typeが未定義のままin_array( $post_type, ...と使われているようです。
    行数多いのですが参考に貼り付けておきます。

    
    function get_robots_meta() {
    	global $aioseop_options;
    	$opts        = $this->meta_opts;
    	$page        = $this->get_page_number();
    	$robots_meta = $tax_noindex = '';
    	if ( isset( $aioseop_options['aiosp_tax_noindex'] ) ) {
    		$tax_noindex = $aioseop_options['aiosp_tax_noindex'];
    	}
    
    	if ( empty( $tax_noindex ) || ! is_array( $tax_noindex ) ) {
    		$tax_noindex = array();
    	}
    
    	$aiosp_noindex = $aiosp_nofollow = '';
    	$noindex       = 'index';
    	$nofollow      = 'follow';
    
    	if ( ! empty( $opts ) ) {
    		$aiosp_noindex  = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) );
    		$aiosp_nofollow = htmlspecialchars( stripslashes( $opts['aiosp_nofollow'] ) );
    	}
    
    	if ( ( is_category() && ! empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( ! is_category() && is_archive() && ! is_tag() && ! is_tax()
    																						 && ( ( is_date() && ! empty( $aioseop_options['aiosp_archive_date_noindex'] ) ) || ( is_author() && ! empty( $aioseop_options['aiosp_archive_author_noindex'] ) ) ) )
    		 || ( is_tag() && ! empty( $aioseop_options['aiosp_tags_noindex'] ) )
    		 || ( is_search() && ! empty( $aioseop_options['aiosp_search_noindex'] ) )
    		 || ( is_404() && ! empty( $aioseop_options['aiosp_404_noindex'] ) )
    		 || ( is_tax() && in_array( get_query_var( 'taxonomy' ), $tax_noindex ) )
    	) {
    		$noindex = 'noindex';
    
    		// #322: duplicating this code so that we don't step on some other entities' toes.
    		if ( ( 'on' === $aiosp_nofollow ) || ( ( ! empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && $page > 1 ) ||
    			 ( ( '' === $aiosp_nofollow ) && ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) )
    		) {
    			$nofollow = 'nofollow';
    		}
    		// #322: duplicating this code so that we don't step on some other entities' toes.
    	} elseif ( is_single() || is_page() || $this->is_static_posts_page() || is_attachment() || is_category() || is_tag() || is_tax() || ( $page > 1 ) ) {
    		$post_type = get_post_type();
    		if ( $aiosp_noindex || $aiosp_nofollow || ! empty( $aioseop_options['aiosp_cpostnoindex'] )
    			 || ! empty( $aioseop_options['aiosp_cpostnofollow'] ) || ! empty( $aioseop_options['aiosp_paginated_noindex'] ) || ! empty( $aioseop_options['aiosp_paginated_nofollow'] )
    		) {
    

    おそらく、コードに問題があるのかと考えておりますが、もし別の原因(例えばaiospの設定不足など)を思い当たる方がいましたらコメントいただけますと幸いです。

    • このトピックはnaoshiroが6年、 10ヶ月前に変更しました。
    • このトピックはnaoshiroが6年、 10ヶ月前に変更しました。
    • このトピックはnaoshiroが6年、 10ヶ月前に変更しました。
  • トピック「プラグイン「All in One SEO Pack」利用時404ページで「Notice: Undefined variable: post_type」」には新たに返信することはできません。