Notice how it is singular? Comment, not comments?
This capability is not designed to check if user can edit any arbitrary comment out there. It can only check if user can edit one specific comment and correct way to call it is current_user_can( 'edit_comment', $comment_id )
.
Unfortunately second argument is missing from current_user_can()
function signature and it is extremely unobvious that some capabilities must be checked in this fashion.
Related Posts:
- How to auto-translate custom user roles?
- How to allow users to view pending posts of a specific custom post type?
- upload_files cap to not loggen in users – add_cap to not logged in users
- Why does admin_body_class not work?
- Removing menus from users other than the administrator
- How to filter reading/visibility posts based on role?
- Testing requested query in pre_get_posts
- Filter and validate user role in registration
- Filter dashboard custom post listing by user
- Block Gutenberg Editor manually by User Roles with a Filter with code
- How to add defer=”defer” tag in plugin javascripts?
- How do filters and hooks really work in PHP
- Trouble understanding apply_filters()
- How would one modify the filtering Gutenberg applies to pasted content?
- Gutenberg: Is there a way to know if current block is inside InnerBlocks?
- How to reorder billing fields in WooCommerce Checkout template? [closed]
- How to add a custom CSS class to core blocks in Gutenberg editor?
- WordPress Internal @ Mentions
- Filter translations (gettext strings) on specific admin pages
- Is it possible to use object in add_action?
- Filter hook before create order WooCommerce
- Add Class to Specific Paragraph of the_content()
- add_filter for specific pages
- apply_filters() slices away needed arguments
- How to add attribute to output with wp_video_shortcode add_filter
- How to override the email function by using filters? [closed]
- Remove WPML’s home_url filter
- Change default settings used by gallery shortcode
- PHP5, Inheritance, Singleton – action & filter hook limitations
- Please explain me what the do_action does
- Add ‘if exists’ to filter
- How does WordPress call functions attached to a certain action hook before calling functions attached to other hooks
- How to get current action?
- How to check if “media_send_to_editor” is audio?
- Changing Order of Filters
- Please help me through this example with a filter to understand how they work
- how to change appearence of the content of default post list columns?
- Filter custom post types in archive
- Use safety filters even if after applied intval?
- Allow unfiltered HTML in titles for low level users?
- How can I filter block registration based on post-type? (Block alignment settings)
- wp_insert_post_data filter not working correctly after upgrade to WordPress 5
- Modify site URL via functions.php of a theme
- Yoast SEO hooks overriding themselves
- Passing variable from child theme to parent theme
- How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?
- How to take options from form fields and turn them in to links?
- How add a group by to the query used by the media library?
- Create Page Template by hook programatically in Functions.php in WP 5.8.1
- How to properly modify WP Vary or any existing headers?
- HTML and custom field variable, inside variable
- how to use force_filtered_html_on_import in add_filter?
- Filter Hook callback error, is it due to using $this inside a filter or something else?
- Disadvantage of using filters & hooks multiple times
- How To Override A WooCommerce AJAX Function
- Can I override the content array using the_posts filter?
- How to use do_shortcode_tag to modify the output of a shortcode?
- Get The Caller (Plugin / Theme / Core) For All actions & Hook in WordPress
- How to trim white space in search terms?
- Changing the argument of a function
- Alter existing page contents based on url
- How to include add_filter() in a condition based on $post data
- Admin: how to make a custom list filter button send GET queryvars
- I’ve set up an extra field for all the available widgets. How do I show it’s value in the front-end?
- What would cause the gettext filter to not work for a given text domain?
- pre_get_posts to hide everywhere posts from “Archive” category
- Strip $before & $after strings from a page title
- How to remove shortcode(s) from WYSIWYG Page editor for Non Admins
- What is the action or filter for adding information under the Permalink in Edit Post/Page?
- add after content don’t work
- How do I safely force get_theme_mod() to use a defined get_option(“stylesheet”) value?
- Shortcode / plugin with custom (flexible) output
- Adding a filter to related posts not working
- need correction with a snippet in functions.php [closed]
- Sql query does not work well
- Is it better to use a constant or apply_filter?
- add_action with associative array
- Why does wp_die() not work when inside a namespace?
- Apply pre_get_posts filter in a certain moment (just for a particular block of posts)
- Remove image of srcset
- Add option to query string before get_posts() is called on archive.php
- Modify wp headers on specific page
- Set post featured image to author image
- How to Change the WordPress Locale with the ‘locale’ Filter?
- meta box loop problem with a search filter
- How to make the show as a button?
- Why this remove empty paragraphs from the_content does not works?
- Take filter from multiple functions
- Read More in the actual excerpt
- WP REST API v2. filters doesn’t work
- Is it possible to include the add_filter() function within a shortcode function
- Activate short codes for all post queries?
- Save something to global var in add_filter
- filter on the_content stopped working when I updated to WP 3.6.1
- Replace Paid Shipping Method With Free Shipping Method WooCommerce [duplicate]
- Wrapping Featured Image on Add/Edit Page in div?
- Clean/filter HTML inserted to post content by XML RPC
- how to localize the number of wordpress post views?
- Is it possible to make get variable out of filter in Class?
- NextGEN Gallery: Adding drop-down menu widget to gallery view without modifying plugin code [closed]