The is_author()
conditional can be used to check if the query is targeting an author’s page. By passing one or more User IDs/nicenames into it, it will check for specific author pages. So to check if the current author page is for the current user, it can be passed the return value from get_current_user_id()
:
if ( is_user_logged_in() && is_author( get_current_user_id() ) ){
echo "belongs to current user ";
}
else {
echo "not belongs to current user";
}
Related Posts:
- Dynamic User Id
- Query posts by post type, author and post meta
- How to store and receive variables in WP sessions?
- $wp_query initiation?
- Getting all user metadata from user
- author.php with ACF and CPTs
- Query to return maximum of one post per author
- How to add custom query filters in WP_User_Query
- Show only oldest post by author
- Custom archive page based on array of categories and tags
- Function to check if author has posted within the last x days
- Show one post per author and limit query to 8 posts
- Filter user list that meta_value is empty
- Query wp_usermeta alongside wp_users
- Pagination 404 errors for author posts query on author.php
- SQL User Query by Multiple Roles using PHP
- Only display authors who have posts
- WP-Admin edit.php & post.php slowdown after import of 10k users
- Get List of all the Authors
- WP User Query get all authors with last name starting with specific letter
- Tell wordpress to show a single page instead of an archive
- Sort users by “birthday” using WP_User_Query
- List of the years with posts presented
- From where is archive.php getting its posts?
- Display posts from only one post form in custom query and exclude in main query
- Hide Administrators From User List except current user (administrator)
- Remove category from query (show all posts in archive.php) pre_get_posts()
- How can I display list of all posts from a specific author, with publish dates in the future, on an author archive page (author.php)?
- Get authors by term id or slug
- How to display user order by role
- Import wp users via one click demo option
- Custom Query by Author field and meta
- slow WP_Query for non-admin user
- Two loops on archive page
- How to order posts by title after they have already been sorted by category
- Filtering out child category posts from parent category archive not working
- WP_Query (list) posts according to author’s custom field
- How to store and receive variables in WP sessions?
- Exclude some authors from query
- Get author if post has multiple authors
- All posts returned when author of 0 is queried
- Prevent author bio page from showing in search results
- Get multiple users with meta value in one query and populate WP_User class
- Posts in loop all show the same author when there are many authors
- Reduce number of SQL queries inside WP_Query loop to fetch author data
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Get user first name from custom endpoint
- Exclude authors IDs from WP_Query
- Filtering posts by archive showing all years
- WP_Query author parameter not working
- Storing an array of objects related to each user
- Create one-use post dynamically, add to main query, do not insert post (user profile view)
- query post by author gender
- Creating attachments archive in tags and categories
- Post archive for certain post format
- How can i show pagenavi in my author.php?
- Query to get last posts from authors of blog
- Creating ‘posts page’ loop based on the page itself
- get_children() Archive Template
- In a WP_Query can I force the results’ is_singular() to be set to false?
- Query pages created by deleted users
- wp query to use both author id and meta_query
- Counting instances of words in the results of a post query
- Random users always showing same 8 users
- Pagination not working on archive.php template?
- How do I stop the same post showing multiple times in a archive?
- Get authors list and sort them by recent posts
- Set “editor” role to existing user
- How to query 5 users in random who have published more than 10 posts
- How to query users by post count no less than 10
- Merge wp-query and get_users
- Get all wp_users sort by metakey
- query all posts published by certain user id
- Logging search queries for logged-in users
- List users by Year of Birth using a foreach loop to dynamically populate years and data
- WordPress custom query by archive title
- In Product Category archives how to show Posts having same/similar prod_cat slug structure?
- Show subscriber id in loop
- Show full category tree for a year with all post titles?
- How to allow Readers to Select Post Order?
- Get X posts for all post types on Taxonomy term archive
- How to add archives (with pagination) to page template?
- WP Query get posts by specific author IDs if one of several logged in authors
- Query Users by post count, last 30 days and display each users post count according to post type
- Get users query makes the site loading time too big?
- Main loop querying current template’s info only in custom category archive pages, not my posts
- query only direct child and sub-terms of a current term archive
- the_excerpt() not working in custom archive
- Get all user with both meta_value
- In loop: posts have thumbnail AND other variables
- Add and in the header while looping over custom query in page template
- Can certain (site-crashing) limitations on WP_Query in shortcode be overcome?
- Get users that likes the post
- Change query from cat id to slug or name?
- Orderby custom meta returns random order
- Query not sorting DESC
- Custom Post Type WP_Query with filters and search
- WordPress meta_query not working
- Unable to pass variable
- How to display posts from a specific term first then another posts from another terms using tax_query