php - Show icon on frontend if current user is the author of post
one text
Solution:
Try the below code. code will go in your active theme functions.php file.
function current_user_is_post_author(){
if( is_single() ){
global $post;
if( get_current_user_id() == $post->post_author ) { ?>
<style type="text/css">
#profile_edit_button {
display: flex !important;
}
</style>;
<?php } }
}
add_action( 'wp_head', 'current_user_is_post_author', 10, 1 );
Source