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 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
- $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
- How can I display a specific user’s first published post?
- wp_insert_post let users post to without login…broke
- Allow anonymous users to post to my site for moderation
- disable column on post and user list
- Can a page_id and a post_id be same?
- How to list users and their post amount?
- Getting current post ID in functions.php
- UberMenu list current user’s posts as menu items
- Buddypress activity id
- count the total number of comments the user has received for his published posts
- 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
- 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
- How do I manage my users post before publish?
- How to get a post’s content? [closed]
- How do I retrieve a users’ last 5 posts?
- Gather posts into a cart/lightbox and share with another user
- How to get ID of the page included with get_page()?
- How to I retrieve the ID from the Posts page?
- Crazy Question – Updating Post ID
- Why I can not I use the variable outside my function?
- Add field to user meta table in database when link is clicked
- Hide comments and posts posted by other user
- Automatically create a default set of posts for each new registered user
- retrieve the oldest post id
- Summary of Posts by an User
- Display a list of users who have viewed the post you are viewing
- Check if current user has a post and that post has any term/s from a specific custom taxonomy outside the loop
- Deleted a user with administrator rights. Now all the data/content/images are lost. how to recover them back
- create front-end users post list by specific category
- Show number of posts by logged in user
- WP_Query custom field pass the post id
- Accessing Post ID Within Loop
- Are post, page and category IDs unique to each other?
- Retrieve data from post meta meta_key having ‘_product_fq_image’ while having author_id and post type is PRODUCT
- The loop starting at a certain ID
- linking to post outside the loop
- Widget to show posts in the sidebar basing on its IDs
- Cannot select certain authors for posts after import
- Get a post’s ID
- Making posts permalinks consistent numbers
- How to get post id of last approved comment?
- How to get the post id (of the parent custom custom type) in a loop inside a widget?
- How to limit post (Exception pages) for current user in each role in front end?
- Get post slug and match with menu item slug to change css
- WordPress Post ids big increment
- How can get the last post date of the user?
- 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
- 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
- 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
- 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
- View post with specific category id and name which I selected in the backend (drop-down option)
- Automatically select category based on user role
- 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?