For some reason, ‘user_id’ => $user->ID, is not working since I did not set global current_user on. The first three lines should be replaced with something like this:
<?php
$args = array(
'user_id' => get_current_user_id(),
Now it’s working 🙂
Related Posts:
- Why are the comments disabled by default on my custom_post_types?
- Why are comments and trackbacks still getting through for custom post types?
- Display Authors Comments on Profile Page
- List all posts commented by current user
- Custom Comment Types
- modify all posts of a category to “no comments allowed”
- Custom comment status possible?
- feed links for custom post type pages
- Seperating custom post type comments from regular blog posts comments
- Add comments meta fields to comments metabox on post edit screen
- Exclude post_type from admin comments_list
- Recent comments on author page?
- wp_query and comment_parent – select only posts with top level comments
- changing default comment form arguments [duplicate]
- Comment moderation on custom post types
- Automatically check “Allow comments” for custom post type [duplicate]
- How could I create a ‘private comments’ section on a custom post type?
- Disable comments from showing up public for Custom Post Type
- Custom Post Type loops and Disqus
- “Allow Comments” box cannot be checked
- Separate comment section for post type in dashboard
- Count all comments of a custom post type
- custom comments on specific post type
- Insert data on comment post
- Custom Post Type Set Comments ON by default without show METABOX
- WordPress comments_open for specific user role or post type
- Add custom field in comments form
- Create another comment system for CPT
- How can the recipients and content for comment email notifications on a custom post type be changed?
- Convert comments to Custom Post Type
- How to assign classes to all elements?
- custom comments form for custom post type
- What functions does WordPress use for filtering / sanitizing comments?
- comment_notification_text filter for custom post type
- get comments by current user inside page template
- User-submitted reviews of different custom post types
- Check if user has comment on current post
- Enable comments on custom page type – option not showing in “customize” for theme
- Allow anonymous comments just in a custom post type
- duplicate comment section functionality and call it something else for custom post types
- Send email messages after comment was submitted
- comments hooks on custom post type
- custom comment fields on CPT
- unapprove comments on custom post type
- Enable comments for post when comments meta box removed
- Get the latest comment from a custom post type where depth = 1?
- Why will comments not remain open on custom post types?
- How to add comments to my custom post type but hide it from default WordPress Comments section?
- How to change the comments form title based on post type
- Comments on posts with new custom post type redirected to another post
- Display custom posts, ordered by most commented, without duplicates
- get comments for custom post type
- How to create a discussion post when a custom post is created?
- Adding second comments.php for reviews
- Custom post type updated to support comments, yet comments don’t appear
- Comments not enabled for custom post types
- Turn off comments for given CPT checkbox?
- Author profile comments system
- Custom post type: can’t enable comments by default
- Comment moderation with disqus comments
- add comments custom fields after user is logged in
- Comments are not working on Custom Post Type
- Error 403 when posting comments to a custom post type from a different page
- Comments not working (error not allowed) on posts with custom post status
- Set posts of a custom post type to be private by default?
- register_post_type sort order by title by default
- Order users by number of posts
- Using previous_post_link and next_post_link to wrap around post sequence
- Replacing the title in admin list table
- Get URL for specific post type and current tag
- How to set custom post type as post title to avoid ‘Auto Draft’
- How to validate custom fields for a custom post type before insert?
- Prevent authors from creating new posts of specific custom-post-type
- How can I get the first 50% of all posts (within a custom post type)?
- Subpages for Custom Post Type. Does that even exist?
- Custom post type: check permissions and validate nonce
- Custom date changer post_date => future – missed schedule error
- How to sort the admin area of a WordPress custom post type by a custom field
- How to make WP_Query not to show irrelevant posts?
- Display custom post types in wp_list_pages
- How to list tags from custom post type attachments?
- Custom post type index (maybe using get_template_part)
- Custom post type menu
- gutenberg message
- How to sort a WP_Query by a custom field AND ALSO filter by a different custom field
- Print all the tags from a custom post type
- does wp_insert_term link the term to a certain post ID?
- Ideas to connect external database table to wordpress posts as custom field source
- Custom post type category permalinks and archive pages
- Navigate by Tags inside a custom Post Type
- programmatically generated custom post type is created more than once
- How to show posts of the same category on a page?
- Button link display in shortcodes using custom field in ACF
- Can I manage current & past editions of an annual event with a single WordPress install?
- Taxonomy to Post Type. Every Taxonomy Item can be Producer or Developer
- WordPress Front-End user restricted taxonomies
- do action inside a class is not working
- Custom Post ‘Post Per Page’ Crashing Page?
- Create an additional template page for every term taxonomy
- Change the text on the Publish button