try this:
$args = array(
'author' => get_current_user_id(),
'post_type' => 'YOUR_CUSTOMPOST_TYPE',
);
$author_posts = new WP_Query( $args );
if ($author_posts->have_posts()): while ($author_posts->have_posts()) : $author_posts->the_post();
//DISPLAY CONTENTS HERE
endwhile; endif;
wp_reset_postdata();
wp_reset_query();
replace YOUR_CUSTOMPOST_TYPE with your post type,
what it does is finds posts of certain post type whose author is currently logged in user.
Currently it queries posts whose author is currently logged in user, you can list other users by using get_users(), full description here, and set 'author' => get_current_user_id() to 'author' => $ID_OF_USER
Related Posts:
- Search multiple custom fields by using meta_query
- Custom Form / Search with Custom Post Type Data
- How can I fetch all the dates from custom fields from various different custom post types and show / list them at one place in ascending order?
- Sort CPT by taxonomy AND THEN by custom field
- Multiple orderby values in WP_Query
- WP_Query orderby custom field then post_date in one query
- how to filter by last name for custom post
- Filtering a WP_Query meta_query by numeric values isn’t working
- Filtering a WP Query result
- Display Custom Post Type Fields
- Add custom field to media attachment image attribute in post editor
- WP_Query on custom post type not displaying, multiple loops & get_template_part
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- WordPress query by multiple Custom fields and order by date
- How can I customize “Pages” admin (edit.php) and “Edit Page” admin (post.php) for bulk edit of custom content type?
- Get post info inside modal window?
- WP Query group/order by category name
- Having trouble with custom date field for CPT query (WordPress)
- Display posts if a custom field value is equal to another custom field value
- Community and User Generated Content Website: Have been thinking about Drupal but leaning on WordPress heavily
- Impossible to get Attachments Outside WordPress?
- Related links – from other sites
- Saving repeated option values in a custom query
- Filtering by Post Meta Custom Fields – Performance
- WP Query—Relationship between two custom post types and their fields
- How to dynamically attach pictures to a carousel
- Assigning the same custom meta box to multiple post types
- Dynamically add / duplicate custom meta in custom post types
- How to insert content from another Custom Post type into Post?
- Custom Post type and Custom Field WP_Query
- How to structure a site with product variations pages?
- WP_Query: include custom post type only with specific meta value
- WP_Query orderby modified to include custom meta changes
- WordPress custom loop filter by meta_key and value with serialize data
- Returning a list of custom post types excluding those without a specific meta_value
- Problem querying Custom post type by custom fields
- WP_Query order by custom field, then randomly order some of results
- Query custom post type with ACF Date
- Query Multiple Custom Posts by Custom Fields
- Get Posts by multiple custom fields is not working
- Order Custom Post Type by Custom Field Value
- First custom field value (out of several) displayed twice after query
- Cannot save CPT meta box
- Possible to filter custom post type with multiple meta data?
- How does order=asc effect a wp_query (its acting pretty weird in a loop)
- Query based on custom fields start and end date
- Redirect to another page using contact form 7? [closed]
- DIsplaying URL of custom field in last post of certain taxonomy && post type
- Display post from a date range from custom field
- post_per_page ignored in WP_Query
- Getting a custom post’s custom field based on another custom post’s custom field select
- WP_Query orderby not work with meta_key
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- Group by custom field value (start and end times)
- Need to have an archive widget which organizes and displays a custom post type using a custom date field
- How to keep a record of changes to a custom field?
- How do I list a custom field and custom taxonomies for each result in a loop?
- Related “custom post type” using “custom taxonomy”
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- WP query_posts group by meta field related
- Adding a location field to buddypress activity
- Create if else for post types in WP_Query ‘post__in’ values
- WP Query from two Custom Post type fields as statement
- Query custom post type that has a serialized relational advanced custom field value
- Auto update publish date of CPT Post if default post custom field value match to cpt post CF Value
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- WP_Query get always custom post_type for first
- How can I query and sort custom-post type using WP_Query
- Filter posts by their related field’s custom field
- Query custom post type and custom field by URL parameters
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- Query a Custom Post Type using SELECT that has ACF fields to compare dates
- meta query multiple values for the same key
- Sort custom post archives by a meta value from a different custom post type?
- Displaying posts inside table having issues
- Custom post types – meta_query: search lesson which starts sooner
- Automatic Set Category For A Custom Post Type
- How to Disable option of meta field if that option is selected for any other post in custom post type?
- sorting in wp query based on custom field value
- Multiple WordPress Sites, Same Database but Filtered Content
- WordPress query in which condition uses custom field
- WordPress loop add heading before first of type
- Error in WP Query. If variable is empty it is displaying previous post value
- WP_Query for CPT with filter by another WP_Query
- Calling specific page with wp query
- Selecting posts older than the current Unix epoch timestamp
- WP_Query get posts where post_name is empty
- Storing/querying custom date data
- Select Menu for Custom post Type does not save
- Query recent posts by author
- Querying meta values within an array
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Filter Custom post type by another Custom post type
- Exposing custom fields to the user in custom type post
- Creating post custom field text area
- querying to custom field over ACF REST API
- Display ACF object field data using Elementor Custom Query
- WordPress custom field sorting, weird behavior: the latest post is at the end
- WP Query + custom fields: How to query event posts from the current date backwards 6 months and organize it month by month?
- How to display *block number* instead *date value* on WordPress posts?