A compacted version that does not load the globals yet calls upon them directly.
if(
is_user_logged_in() and // Force user validation... STUFF
!empty($GLOBALS['post']) and // Check if a $post exists in globals
!empty($GLOBALS['current_user']) and // Check if current_user exists in globals
($GLOBALS['current_user']->ID == $GLOBALS['post']->post_author) // Match User IDs
){
// This is your Author speaking, use the Force!
}
Regards.
Related Posts:
- Get page ID of page that is set as the posts page
- Update post counts (published, draft, unattached) in admin interface
- How to Display a List of Users Who Have Made at Least 1 Post?
- Are post ID’s reliable?
- Get current post id in functions.php
- Find out who deleted a page or post?
- get all posts ID from a category
- Get the current post ID as a variable in Javascript
- WordPress: How to get the current logged in author page URL?
- Is post ID number always incremental n+
- disable password protected page for logged users
- Force “Submit to review” when a post is updated
- Are all ID’s used unique?
- $post->ID displays wrong ID
- At my posts archive page, outside the loop, get_the_id() returns the top most post’s ID
- Overview with latest edited posts and pages
- Navigation link to specific user page
- Get how many days since last post of the current user
- Showing random content / pictures from earlier posts in a sticky post?
- Hide comments awaiting moderation from user who submitted the comments
- Get the post_id of a new post
- get post id in while loops outputting page id
- How can I display a specific user’s first published post?
- Undefined variable post_id in custom quick edit coloumn
- Query All users that has post
- Limit number of posts a user can make per minute?
- How do I allow users to follow a post and then allow admins to email all users who have followed that post?
- wp_insert_post let users post to without login…broke
- Get user’s most published categories
- Allow anonymous users to post to my site for moderation
- Getting post id from wp_insert_post_data function?
- Does an article (post) id ever change?
- disable column on post and user list
- How to get the post’s parent ID?
- Can a page_id and a post_id be same?
- Is there a better, more efficient way to get the post id outside the loop?
- how to find user ids of all commenters in a post
- How to list users and their post amount?
- Is there any way to allow users to access content before it’s published?
- Getting current post ID in functions.php
- UberMenu list current user’s posts as menu items
- Buddypress activity id
- Create post for every user?
- count the total number of comments the user has received for his published posts
- How blog page in WordPress works : blog page retrieve first post ID
- Restrict users post for himself
- Post-ID in url differs from $post->ID
- Why is my Blog Page ID == First Post ID?
- How to allow logged in users to post anonymously
- Allow public to post on blog
- Is it possible to change post id for an already added menu item in WordPress?
- How to verify wp user password by sql query in wp? [closed]
- Get ALL post ID’s export list (Only id’s. Php or sql not important )
- How to get next post ID?
- How can i delay reading posing in 3days for not logined user?
- Search results posts_orderby and ID
- Encountering “Wrong nonce. Action prohibitied.” when trying to alter User Role and unable to Post via WP Admin
- Users problem (multi-author plus multisite)
- Get post slug and match with menu item slug to change css
- WordPress Post ids big increment
- Reuse old post ID for new post after deleting post
- How can get the last post date of the user?
- Get post attachment with post id
- Is there a way to save different data when USER interacts with the same POST?
- How to display particular categorie’s post which associated to specific user?
- WordPress Delete Users from backend doesn’t work
- Allow users to post their videos to my wordpress website?
- How can i take all ids from untrash_post action?
- How do I apply a wordpress function to something with no ID inside an archive page?
- Get from the dashboard the ID of the current post being edited
- Compare date of user’s last posts
- Only get post_id [duplicate]
- Add new post only in assigned category
- WordPress each user has each content for a page,how to do that?
- Surrogate ID for posts, is there an alternative field in the posts table?
- Is it possible to have dynamic post id # in add_menu_page()?
- User rank in wordpress post
- Count how many posts a user has viewed
- Allow users to create their own page/s
- Get current user array with post string
- My posts section for logged in user
- Using Post ID and Page ID in same function
- Show Custom Post From Logged In Author
- Delete old post with new post
- unused post IDs
- How to handle dates, trying to calculate time since a post
- each user having category with their name and can add sub categories post in that category
- The post order is different for logged-in and non-logged-in users? [closed]
- Custom post page has attributes of latest post [closed]
- Can I get custom post items in select box (dropdown)
- User submitted post
- What is $post->ID
- View post with specific category id and name which I selected in the backend (drop-down option)
- Automatically select category based on user role
- Undefined Function Fatal Error with Shortcode [closed]
- How to get post ID after removing that post?
- How to allow Contributors to edit their own posts, whilst still needing to be reviewed by an admin?
- Allow users to edit post without logging in
- Does WordPress Super User or Administrators can create and edit post and media on behalf of a user
- Why does ‘get_the_ID’ work outside of the loop?