I have tried implementing this example provided for changing the displayed name for a comment:
https://wpdiscuz.com/docs/codex/filters/wpdiscuz_comment_author/
I changed the code to remove the if statement:
add_filter("wpdiscuz_comment_author", function ($authorName, $comment) {
$authorName = "Boss";
return $authorName;
}, 10, 2);
However this still does not change any displayed author names:
I added the "wpdiscuz_after_comment_author" filter and that works perfectly. Please help!
Hi @serveracademy,
Please navigate to Dashboard > wpDiscuz > Settings > General Settings tab, and delete the wpDiscuz caches using the "
Also, don't forget to press Ctrl+F5 (twice) on the frontend before checking.
In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.
EDIT: DISREGARD THIS REPLY AND SEE ABOVE SOLUTION FOR PURGING CACHE
After inspecting the plugin code, I found the filter is ONLY firing for comment replies:
I believe this filter should be applied to base comments as well. After reading this documentation linked below I decided to edit the template and add support for the filter myself.
For anyone else following behind me, this documentation is a bit outdated as well because I could not locate the CSS file at '/wpdiscuz/assets/css/wpdiscuz.css', but thankfully I did not need it.
https://wpdiscuz.com/docs/wpdiscuz-documentation/customization/custom-template-and-style/
I copied 'class.WpdiscuzWalker.php' into my child theme folder (/wp-content/themes/mytheme/wpdiscuz/', and around line 254 I added the following code:
$uNameClasses = apply_filters("wpdiscuz_username_classes", "");
$user["authorNameHtml"] = '<div class="wpd-comment-author" style="padding: 0px;">' . apply_filters("wpdiscuz_comment_author", $user["user"]->data->display_name, $comment) . '</div>';
$user["authorNameHtml"] .= apply_filters("wpdiscuz_after_comment_author", "", $comment, $user["user"]);
Now the author name I configured in the filtered function is displaying as desired. Again, I believe this should be included by default and I believe this is a bug.
@asti I was writing my reply below before I read this comment. I undid my work and purged the user cache like you mentioned and it worked!
It would be amazing if we could add comments to the docs codex or if this could be noted there.
Please watch this video: https://www.screencast.com/t/MHItBGTip
The hook code works fine.
In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.
@asti Fantastic, thank you! It would be amazing if we could add comments to the docs codex or if this could be noted there.




