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
- Using register_activation_hook in classes
- WordPress and event-driven programming – what is it about?
- Display user’s total comment count outside The Loop
- Facebook Comment Count
- How to remove a metabox from menu editor page?
- WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end
- Allow authors to post only in categories they create in WordPress
- Audio Player not loading when the content is loaded through Ajax, MediaElement.js no applied
- How to Remove a Filter from the Admin List Table?
- How do I create comment-reply-button using element not
- Woocommerce, recognize the loop of related products
- How To Change The Html of Products filtration sidebar in Woocommerce?
- Automatically generate Post/Page from searched Database item?
- Insert all post IDs in new database table
- How Can I Call Up The Author’s Name on a Post
- How to add a second ‘place order’ button in WooCommerce [closed]
- How to do multiple searches (with logical OR) in WP_Query in hook pre_get_posts?
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- How does this WordPress Plugin (Thrive Comments) apply their custom comment sort? [closed]
- Setting up 2 SMTP accounts: 1 for wordpress and 1 for woocommerce
- wp_loaded hook block script enquequing
- Show comments menu in dashboard only if the site has comment
- Remove an action hook within a Class
- How to pass arguments to add_action() or retrieve return value of called function?
- hook that when page is starting to load
- How to change home or site url using action hooks or filter?
- 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?
- How to add an arrow to menu items has submenus
- Don’t insert if permalink is the same?
- Return a numerical function value in Customizer controls
- wp-comments-post.php file returns a blank page
- Why does wp_head hook my functions to the beginning of my source code?
- Pass argument to event hook
- Get post id within comments loop
- WordPress comment submit button substitutes/options
- get comment data using comment id
- Removing the comment function within wordpress
- How to catch wordpress post ID when it’s published
- Why does the post_type_link hook everything twice?
- How can I hook into the wp_mail function used by BackWPup?
- Fetching Initials of the Commentator in the WordPress Website
- Adding function to child theme’s function.php
- get_comments_number() returns 0
- 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?
- Add a custom class to the body tag using custom fields
- Why doesn’t global $wp_query not get hooked?
- Conditionally load class in the comment section of the post page
- How to get comment_ID by post_ID in wordpress
- How to pass hook variable to function?
- Fatal error: Cannot redeclare comment_theme()
- Create condition for Author bio Social Links
- How do I add a function to parent theme
- comment_post (if comment is approved OR $comment_approved === 1) not working?
- WordPress redirect to a subpage – how to create a template for subpage?
- Use wp_head hook on template page
- Commenting requires wordpress login, wordpress discussion and post comments tick boxes are checked
- Adding custom field to product category and show it to shop/category shop page
- Show sidebar only to author of post
- How to edit post meta data before publishing the post it self wordpress?
- Get original value in save_post action hooka
- Comments on my custom post type
- get Woocommerce product format json for WP_Query
- Register/enqueue scripts only on certain admin pages
- Is there an option to execute javascript file only on plugin activation
- How do I remove an action hook inside a class that is called by another class?
- Help hooking into user_register
- Return author name as a tag using get_author
- Hook into all password resets in WordPress and get password before hashing?
- Following/Followers Users list Using Ajax Pagination inside Author Profile
- Real time notification on user profile after new comment
- Why transition_post_type hook is called twice for the same post?
- How can I move the posted-on date above the post and below the entry-header?
- Post formating on Home page
- Getting most popular posts based on Facebook comments count
- WordPress HTML Helper
- A Space being added to url generated by custom plugin
- calling a function from a class in your template
- WordPress – show number of comments for each post in widget
- How does add_action ‘comment_post’ work?
- Custom action on comment post
- WordPress most commented posts of last X days
- How to convert my comment.html to comment.php
- Change Checkout “Place Order” text if cart has a specific product
- transition_post_status hook, works – but not if the post is new
- php was updated – critical error [closed]
- Facing Problem While Running WordPress Hook For Archive, Categories, Author, Date Pages Only
- Woocommerce – add tracking code to another email template