Just compare display names:
$currentuser = get_currentuserinfo();
if ( get_the_author() == $currentuser->displayname ) {
// current user is the post author; do something
}
The get_the_author()
function returns displayname
, which should be able to be compared against the displayname
parameter that is a part of the $currentuser
object.
Related Posts:
- Send email to admin with post author
- How to remove a column from the Posts page
- Update post counts (published, draft, unattached) in admin interface
- How to display by default only published posts/pages in the admin area?
- Set Default Listing “View” in Admin
- display all posts in wordpress admin
- Hook that get’s triggered when the author of a post is changed
- the_author() returns empty string
- Prevent Authors from viewing each others Posts
- Display Random Author with Details in Sidebar
- Sends out email to admin
- Can I force a metabox to be in one column?
- Add a new post status in the post progression
- How to show list of posts by author and category?
- Help! Turn php link data into url OR hide edit link in post admin OR hide drafts for all users except admin?
- WordPress: How to get the current logged in author page URL?
- Modifying admin sidebar contents to show pending posts indicator
- How to add editor’s name to entry meta byline?
- Different permalink for posts and authors
- Any way to create a revision of a post ONLY with a new button in the Meta Box?
- using slug instead of ID in admin edit post url
- How to display posts by current user/author in a custom page template?
- How to Load Scripts and CSS for Admins Only When Editing or Adding Posts
- Query posts distinct authors
- Add “Post Options” for new wordpress post
- Restrict the Number of Posts an Author can Publish (over time)?
- Post Admin – Filter by posts without tags
- Search posts by post author name
- Add javascript when post is published
- Get the user type of an author
- Show the title of the latest post by author
- Why does the_date work in the first custom column, but not in the second, in a series of customized Posts columns?
- Find most recent authors
- Add link on the top menu of the post table?
- Add a special filter link to All Posts in admin
- Show author post count in sidebar – Variable
- which action to hook to in order to perform post-publish action
- Get current users post URL?
- Get the author of the latest revision
- Filter posts by author and category simultaneously
- Make “Post published. View post” Open in a New Tab
- Custom Post Type & Author not associating, user post count is 0, api doesn’t return author in post objects
- Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?
- Overview with latest edited posts and pages
- Hiding by default specific post status on backend list?
- Custom colors for post rows based on post meta value
- How to add an admin function only to posts, not pages?
- prevent showing posts of an specific category in admin posts section
- Post author is changed to admin after his post is modified by admin
- Remove whitespace at the end of posts?
- Get all posts by post_author
- Allow role to delete posts but block him the wp-admin
- Is there a way to change the color of a row in Post Administration based on the type of post?
- Add filter-by-tag in the all posts admin console page
- How can I control multiple editing of wordpress posts?
- Multiple authors for single post without plugin
- Limit number of posts a user can make per minute?
- How to get a nofication when post submitted
- Authors in menu, template list post by author
- Show the author’s count of total amount of posts assign to a custom taxonomy term
- Author must complete profile info before they can publish a post?
- WP rest api returns 404 only when author param is used
- How can I list random authors from current post category?
- How do I add a custom body class to the admin area of a page?
- Adding a text link under the post title in the lists of posts
- Is it possible to change the admin posts per page view?
- Remove the Edit button in posts for permalinks on certain user roles? WP 3.3
- Change default Posts page
- How can I show wordpress posts based on author?
- Auto “expire” all of an authors posts on spcific date
- How to get the user meta data for a post?
- Limit posts per author role (excluding admin) in home page
- Guest Author – How to display posts on /author/ archive page
- How can I show many posts an author has per week?
- Disable inline_edit() on edit.php
- How to give capability (publish contributors posts) to author role?
- Whitelist Author of Private Post
- Show posts by a custom post author
- Change target of view link in admin
- Prevent additional top level categories but allow more children
- Getting the current author (it has changed) of a post, not the original author
- WP Admin register taxonomy and post type performance
- Publish post’s date is set to Nov 30 -0001
- Admin – create custom post status and display above table
- Showing author page if user has no post
- plugin to post from admin to flickr [closed]
- All Posts admin screen – show time underneath the ‘Date’?
- Get post ID in post/page edit area
- Display Notification Bar on Header on Certain Post Count
- How do I retrieve a users’ last 5 posts?
- obtain the author id given the post id
- Show comment number per author per day
- Get all comments of author’s posts
- (solved) getting post author’s user role
- Change all author links in Blog roll
- Display author’s name and avatar in post’s sidebar
- How to remove specific tag from multiple posts?
- How to detect when admin user is on the All Posts page?
- static landing page leading to author specific pages w/ “live” content
- If contributor has published 2 or more posts then show otherwise hide