First of all, you don’t want unregistered users to be able to edit comments, because you have no way of knowing whether they are who they say they are. So, this can only be made to work for registered users.
As you can see from roles and capabilities only editors and up can moderate comments. You can give this capability to others, however, using code like this:
Update Using edit_comment
is better than moderate_comments
, which would be too broad for your purpose, I guess.
function wpse250786_add_cap() {
$role = get_role( 'contributor' );
$role->add_cap( 'edit_comment' );
}
add_action( 'admin_init', 'wpse250786_add_cap');
Related Posts:
- When using the_author hook, how can I determine the PHP file that generates each call to `the_author()`?
- Sending data from custom inputs in WordPress comment form in the admin notification email
- Comment_author_url doing nothing
- Add custom field on admin dashboard comments / reviews
- Show all people who commented on all posts by an author
- How can I output the slug of a comment author?
- Assign new post author IF another user in custom field on post transition
- Guests comment form – prevent duplicate email addresses
- Show wp_die if url form comment not emply
- Why does my callback function not work with this custom filter hook?
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- Reload part of checkout on changed shipping method
- Trying to build simple deposit code that hooks into woocommerce
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Remove metabox from WordPress menu editor page?
- Add a product to checkout via form
- Why ajax doesn’t work on certain wordpress hooks and reload the page instead?
- Why ajax doesn’t work on certain wordpress hooks?
- Remove a div from RSS feed
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- user_profile_update_errors hook not executing
- Set meta field to publish date + 2 weeks
- How to add an arrow to menu items has submenus
- WordPress Gravatar filter is removing my custom attributes
- Error in custom php function doesn’t exist
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- How to implement a rating and review system for WordPress custom posts?
- Don’t insert if permalink is the same?
- Return a numerical function value in Customizer controls
- Adding widgets to my plugin page instead of WordPress dashboard
- Ajax load more button for comments wordpress
- Limit 1 global comment per minute
- Adding function to Genesis genesis_header [closed]
- Create Page To Count Comments For Each Post In WordPress Site
- Modify custom field input data before creating a new post
- comments sorting incorrectly across multiple pages
- Commenting out unwated CSS/scripts in HTML with PHP
- how to make custom ajax handler?
- Are all hooks/functions tied to Kses meant for sanitization?
- wp-comments-post.php file returns a blank page
- php function to display commenter username or login
- Genesis framework comments broken?
- check if comment submitted was successful
- Remove author link wherever author’s name is display
- Alter required message using comment form api
- Why does wp_head hook my functions to the beginning of my source code?
- Pass argument to event hook
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- Should `wp_login` be used since it’s deprecated?
- Get post id within comments loop
- Omit custom post type from wp-sitemap.xml based on meta key using wp_sitemaps_posts_query_args
- Password minimum length in personal subscription [closed]
- How to use a custom hook
- Run a code only on theme activation only during first activation
- Theme activation hook in php class
- WordPress comment submit button substitutes/options
- How to list commenters and days since last commented
- How to add text to the start of all comments?
- Does anyone know all parameters of get_comments()
- Appended comments but they show up above the content instead of below
- get comment data using comment id
- Theme not calling Jquery properly
- Removing the comment function within wordpress
- wp_delete_comment takes two tries to delete – then deletes all comments
- How to remove the message ‘We could not find any results for your search’ without changing template files and without adding posts/pages?
- Get access to variable from previous pageview, excluding ajax-calls
- How to catch wordpress post ID when it’s published
- WordPress redirect redirecting too many times or not at all
- Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution) [closed]
- Why does the post_type_link hook everything twice?
- Send a mail to specific address in a custom field when a new comment is made on a specific post
- Noindex Posts From Certain Authors In WordPress
- How to have different site identity logos on each page on Astra Theme [closed]
- How can I hook into the wp_mail function used by BackWPup?
- Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?
- Get user custom field value on function.php
- Fetching Initials of the Commentator in the WordPress Website
- Send notification email to admin for every new post published
- Adding function to child theme’s function.php
- get_comments_number() returns 0
- Comapare get_user_meta value
- Noindex subscriber author page
- How can I include the user id inside of a shortcode php output?
- How to hide the author box of a specific user?
- Restrict characters in comment section
- Add a custom class to the body tag using custom fields
- Must filter functions receive all arguments passed to them?
- Why doesn’t global $wp_query not get hooked?
- Creating customized php files in theme folder
- Conditionally load class in the comment section of the post page
- Dynamically Generate Functions and Hooks
- How to get comment_ID by post_ID in wordpress
- How to pass hook variable to function?
- Fatal error: Cannot redeclare comment_theme()
- I don’t have comments.php… how do I customize my comment fields
- Create condition for Author bio Social Links
- How to change the author box selection on a post to a custom taxonomy
- save_post trigerred twice
- How to sort WooCommerce products page by latest in-stock items first?