Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurozumi/67ae290c8b969edc89a2 to your computer and use it in GitHub Desktop.
Save kurozumi/67ae290c8b969edc89a2 to your computer and use it in GitHub Desktop.
【ワードプレス】投稿ページのタイトルを一括編集する
add_filter('single_post_title', function($post_title, $post){
$categories = get_the_category( $post->ID );
if($categories){
return $post_title . sprintf("【%s】", implode("|", array_map(function($cat){
return $cat->name;
}, $categories)));
}else{
return $post_title;
}
}, 99, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment