Generate Sub-Comments with WP-CLI [closed]

Currently it is not available in WP CLI. See https://github.com/wp-cli/wp-cli/blob/master/php/commands/comment.php#L136 If you want, you can have your own customized comment generation command. See command cookbook. http://wp-cli.org/docs/commands-cookbook/

if null or int(0) value to 0

There is no use for converting an integer to a string when you just need to display the result or for simple checking against a hardcoded known datatype value. Converting datatypes is only useful when you need to validate values strickly against a certain specific datatype. Your issue is that you do not exactly know … Read more

How to Add text to the start of all comment?

You can use this filter hook to add this apply_filters( ‘pre_comment_content’, string $comment_content ); Here is the code how you can use this function add_custom_comment_content( $comment_content ) { // You can handle it many ways $comment_content .= “Custom Content” } add_filter( ‘pre_comment_content’, ‘add_custom_comment_content’, 10, 1 );

How to amend time format of comments, using child-theme?

You have to return the formatted date string, the following will work: // define the get_comment_time callback function filter_get_comment_time( $date, $d, $gmt, $translate, $comment ) { $d = “g:i:s”; $date = mysql2date($d, $date, $translate); return $date; }; // add the filter add_filter( ‘get_comment_time’, ‘filter_get_comment_time’, 10, 5);

How can get comment id from comment link?

Based on your comment, you can get the comment ID via JavaScript, and here’s a sample function you can use/try: <script> function getCommentIdFromUrl( url ) { return ( ( url && /#comment-(\d+)$/.test( url ) ) || ( location.hash && /^#comment-(\d+)$/.test( location.hash ) ) ) && RegExp.$1; } </script> So if the URL of the current … Read more

How to direct user after comment save

Use the filter comment_post_redirect: add_filter( ‘comment_post_redirect’, ‘comment_redirect’ ); function comment_redirect( $location ) { $location = ‘http://example.com/sample-page’; // or: // $location = get_page_link( page_ID ); // $location = get_page_link( get_page_by_path( ‘sample-page’ )->ID ) return $location; }