[wp-trac] [WordPress Trac] #58700: wp_set_comment_status() modifies post_content

WordPress Trac noreply at wordpress.org
Mon Jul 3 04:42:14 UTC 2023


#58700: wp_set_comment_status() modifies post_content
--------------------------+-----------------------------
 Reporter:  tweakfreaks   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Comments      |    Version:  6.2.2
 Severity:  major         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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
 <?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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58700>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list