在WordPress上提交评论后,自定义”成功”消息

我需要在成功发布的Wordpress评论上显示成功消息。这个怎么做?
#1【在WordPress上提交评论后,自定义” 成功” 消息】请尝试https://wordpress.org/plugins/wp-ajaxify-comments。它将在成功发布的Wordpress评论上显示成功消息
#2没有Ajax或插件。添加到function.php:

add_action( 'set_comment_cookies', function( $comment, $user ) { setcookie( 'ta_comment_wait_approval', '1', 0, '/' ); }, 10, 2 ); add_action( 'init', function() { if( isset( $_COOKIE['ta_comment_wait_approval'] ) & & $_COOKIE['ta_comment_wait_approval'] === '1' ) { setcookie( 'ta_comment_wait_approval', '0', 0, '/' ); add_action( 'comment_form_before', function() { echo "< p id='wait_approval' style='padding-top: 40px; '> < strong> Your comment has been sent successfully.< /strong> < /p> "; }); } }); add_filter( 'comment_post_redirect', function( $location, $comment ) { $location = get_permalink( $comment-> comment_post_ID ) . '#wait_approval'; return $location; }, 10, 2 );

    推荐阅读