Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active Aug 29, 2015
Embed
What would you like to do?
【ワードプレス】投稿ページのタイトルを一括編集する
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