post body class for current user only if they are the post author
I'm trying to find a way to add a body class "author" IF the current user is the author of the post they are viewing.
This is what I have so far...
add_filter( 'body_class','my_body_classes' );
function my_body_classes( $classes ) {
if ( !$current_user-ID == $post-post_author ) {
$classes[] = 'post-author';
}
return $classes;
}
Topic body-class author custom-post-types Wordpress
Category Web