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 eve.gd: Martin Paul Eve on December 10, 2025.
Files
10.59348_qg8yz-7974.pdf
Files
(106.1 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:033fc2c3b0d5730235003e59ee829936
|
106.1 kB | Preview Download |
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-10T00:00:00Z
- Updated
-
2025-12-10T00:00:00Z