Handling 403 errors in BuddyPress's new_activity_comment
Today I had a weird problem. Our BuddyPress activity stream comments were just not working. When you clicked the reply icon, then typed a response and pressed "post", it simply grayed out and never succeeded. I could see, in the logs, that there was a 403 Forbidden error being thrown.
I just debugged this and the answer is quite simple.
In your theme, somewhere, there should be a /buddypress/activity/entry.php file.
In there, you might have something like:
wp_nonce_field( 'new_activity_comment', '_wpnonce_new_activity_comment' );
This is wrong. Change it to:
wp_nonce_field( 'new_activity_comment', '_wpnonce_new_activity_comment_' . bp_get_activity_id() );
And all will be well.
Handling 403 errors in BuddyPress's new_activity_comment was originally published by Martin Paul Eve at Martin Paul Eve on December 10, 2025.
Additional details
Description
Today I had a weird problem. Our BuddyPress activity stream comments were just not working. When you clicked the reply icon, then typed a response and pressed "post", it simply grayed out and never succeeded. I could see, in the logs, that there was a 403 Forbidden error being thrown. I just debugged this and the answer is quite simple. In your theme, somewhere, there should be a /buddypress/activity/entry.php file.
Identifiers
- GUID
- https://doi.org/10.59348/qg8yz-7974
- URL
- https://eve.gd/2025/12/10/handling-403-errors-in-buddypresss-new-activity-comment/
Dates
- Issued
-
2025-12-10T16:55:58
- Updated
-
2025-12-10T16:55:58