>>デイトラ全コースが先着で1万円OFF!

【2021年】カスタム投稿のアーカイブページにメタディスクリプションを出力する【All in one SEO Pack】

iclusta ルートディレクトリ

All in one SEO Packのフックを使います。

以下をfunctions.phpに記載すればOKです。

コードの意味は「カスタム投稿タイプが『shop』のアーカイブページにメタディスクリプションを出力する」です。

////////////////////////////////////////
// カスタム投稿のアーカイブページにメタディスクリプションを出力
////////////////////////////////////////
add_filter( 'aioseo_description', 'aioseo_filter_description' );
function aioseo_filter_description( $description ) {
	if(is_post_type_archive('shop')){ //カスタム投稿タイプ「shop」
      return $description . 'ここにメタディスクリプションに出力したい内容';
   }
   return $description;
}

タイトルとURLをコピーしました