How to get comments from multiple post type?

It looks like WP_Comment_Query() only supports a single post type. You can adjust it, by using the comments_clauses filter. Try for example: $defaults = array( ‘number’ => 5, ‘post_type’ => array( ‘post’,’authors’,’movies’ ), ); add_filter( ‘comments_clauses’, ‘wpse_121051’, 10, 2 ); $comments = get_comments($defaults) where /** * Support for multiple post types for comments * * … Read more

Comments Pagination as an unordered list

As paginate_comments_links() is pretty much just a already customized version for comments of paginate_links(), see the documentation for a deeper insight, you can use the parameter type for this. paginate_comments_links( array( ‘type’ => ‘list’ ) );

Warning: call_user_func_array() expects parameter 1 to be a valid callback, func

I’m pretty sure that function tnc-remove_default_menu is not defined anywhere in your code. (You shouldn’t use – character in function name in PHP). So most probably there is a function called tnc_remove_default_menu, and you’ve misspelled it’s name in add_action/add_filter. If there is no such function anywhere in your code, then you should remove this filter/action … Read more

On WordPress 4.4, how to get the post id using the comment_post hook

The third parameter, $commentdata can be used to get the ID for the post that the comment was made on: function wpse211367_comment( $comment_ID, $comment_approved, $commentdata ) { // The id for the post that the comment is related to is available // in the $commentdata array: $comment_post_id = $commentdata[‘comment_post_ID’]; } add_action( ‘comment_post’, ‘wpse211367_comment’, 10, 3 … Read more

WP comments form (custom) is displaying an extra comment field

It seems that WordPress handles the comment field separately than the other fields. If you look at comment_form() in wp-includes/comment-template.php, you can see this. It’s possible to set $defaults[‘comment_field’] to false in alpha_comments_defaults() then add the comment field markup to $fields[‘comment_field’] in alpha_comments_fields() in the desired order, but this could cause trouble with plugins. I’ve … Read more

How to remove the “on” string before recent comments link?

The source of the text in question lives in wp-includes/widgets/class-wp-widget-recent-comments.php I found it by searching the WP files for the id of the widget, recentcomments, which I gathered by inspecting the HTML of the widget. So, here’s where that on is coming from, with a bit of extra code for context: foreach ( (array) $comments … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)