Make WordPress Core

Opened 18 months ago

Last modified 17 months ago

#58700 new defect (bug)

wp_set_comment_status() modifies post_content

Reported by: tweakfreaks's profile tweakfreaks Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 6.2.2
Component: Comments Keywords:
Focuses: Cc:

Description

I've created a standalone PHP script that runs on cron and uses wp_set_comment_status() to automatically approve select comments (based on user name, ip address, etc).

When a comment is approved, if the post_content contains a video tag, the video tag is rewritten.

From :

<video controls loop width="400" preload="none" poster="https://example.com/images/poster.jpg"><source src="https://example.com/videos/video.mp4" type="video/mp4"></video>

To :

<video controls loop width="400" preload="none" poster="https://example.com/images/poster.jpg"></video>

My code :

<?php
require_once('/example.com/wp-load.php');
...
...
if ( $curTime > $comTime )
{
     wp_set_comment_status($comment_id, 'approve', false);
}

Any idea why this is happening? I've had to go back and edit a lot of posts due to this issue.

Change History (3)

#1 follow-up: @iamchitti
18 months ago

Do you have a plugin installed to enable video embedding/uploading in comments?

I attempted to add a comment containing a video tag, but WordPress removed it entirely. This leads me to believe that you might be utilizing a specific plugin for this purpose. If that is the case, kindly inform me about the plugin you are using. Alternatively, if no such plugin is in place, please provide guidance on how you are incorporating a video in a comment.

#2 in reply to: ↑ 1 @tweakfreaks
18 months ago

Sorry, I should have been more specific.

When my script approves a comment, the actual post of the blog gets modified. That is where the video tag resides (not in a comment).

#3 @tweakfreaks
17 months ago

I'm still having this issue. Any updates?

Note: See TracTickets for help on using tickets.