Hot answers tagged

2

I've often thought this would make a good feature, though I've never seen a plugin for it. I think the term "comment" is probably throwing off your search. I wouldn't think that this would be stored as a comment internally, but rather as metadata for the post. I did a search for plugins using the term "revision description" instead of revision comment, and I ...


2

We can use comment_form function's submit_button parameter to change submit button HTML. Default HTML for submit_button is <input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" /> You can change your code like this. $comments_args = array( .... 'submit_button' => '<div class="form-group"> <input ...


1

Please place below code in your theme's functions.php file and it will wrap the submit button inside div: // define the comment_form_submit_button callback function filter_comment_form_submit_button( $submit_button, $args ) { // make filter magic happen here... $submit_before = '<div class="form-group">'; $submit_after = '</div>'; ...


1

Just as @Jevuska mentioned, you can use the $post_id as an argument here, in fact, you can also use a ton of optional $args as well <?php comment_form( $args, $post_id ); ?> You can find the information in the Codex here: https://codex.wordpress.org/Function_Reference/comment_form


1

Never edit the WordPress core files. Instead you should hook into the pre_comment_content, which is where the comment text from the textarea is being sanitized, before it's inserted into the database. In the example below preg_replace is used to sanitize the comment text submitted. You should modify the function to fit your needs. function ...


1

For anyone else trying to find this: This can be done using the $parent parameter of get_comments. Here is the code assuming $parent_comment_id is the id of the parent comment. $childcomments = get_comments(array( 'post_id' => get_the_ID(), 'status' => 'approve', 'order' => 'DESC', 'parent' => ...


1

The comment_text filter passes the comment as one of its params: echo apply_filters( 'comment_text', $comment_text, $comment, $args ); So you don't need to call get_comment_ID(), you can just access the ID from the $comment object. Change: add_filter( 'comment_text', 'modify_comment'); to: add_filter( 'comment_text', 'modify_comment', 0, 3 ); And ...


1

If you mean the comments in comments_template() then you can use the new comments_template_query_args filter that was added with ticket #34442 in version 4.5: /** * Filters the arguments used to query comments in comments_template(). * * @since 4.5.0 * * @see WP_Comment_Query::__construct() * * @param array $comment_args { * Array of ...


1

Comments automatically use credentials of logged in user. You have two options: Log out of your account and leave a comment like a regular user. Log in into different account via native means or use a plugin that allows you to switch between accounts.


1

Comments are kind of "limited" in WordPress. You have three different types for them as get_comment_type() shows nicely and you can not extend that list. So, adding meta values to your comments is the easiest, and probably "most standard" way, to be able to distinguish different "types" of comments. Handling the comment in- and output stays basically the ...


1

Im not aware of any hook that could change only comment notification recipient.. You would probably need to overwrite some kind of core function but here's a small workaround you could use: 1. Disable the email feature from WordPress comments settings (unless you want to get notified too) 2. Send it manually using comment_post action hook, just add this ...



Only top voted, non community-wiki answers of a minimum length are eligible