If you have a plugin and want to append buttons to wall post commets, for example a share button, or report button, you can do so by creating a function (not method) similar to this example below, created for the Report Master plugin:
function add_wpc_report_button($buttons, $comment, $user)
{
$buttons['report_master'] = [
'priority' => 201,
'tags' => 'type="button"
value="Report"
class="qa-form-light-button qa-form-light-button-report"
data-posttype="wallpostcomment"
data-comment-id="' . (int)$comment['comment_id'] . '"',
'label' => qa_lang('rm_lang/report_button'),
'icon' => '<svg width="18" height="18">...</svg>',
];
return $buttons;
}
/**
* Hook into WPC system
*/
wpc_add_filter('wpc_comment_buttons', 'add_wpc_report_button');
The default/existing WPC buttons priority are:
- Edit button: 100
- Delete button: 200
You can prepend or append yours, by giving a smaller or bigger priority.