[wp-trac] [WordPress Trac] #49684: Why the wp_die() method corresponds to different styles in different topics?

WordPress Trac noreply at wordpress.org
Mon Mar 23 10:59:35 UTC 2020


#49684: Why the wp_die() method corresponds to different styles in different topics
?
--------------------------+-----------------------------
 Reporter:  shenyanzhi    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  5.3.2
 Severity:  normal        |   Keywords:  dev-feedback
  Focuses:  ui, css       |
--------------------------+-----------------------------
 I used wp_die () in the plugin, but I get user feedback and the styles are
 inconsistent. Why?

 The theme I use uses wp_die () to prompt a pop-up window, and the theme of
 other users is the default error page. I tested the default theme and the
 default error page.

 ```php
 // check comment
 function bdtc_refused_comments($comment_data)
 {
     $option = get_option('BaiduTextCensor');
     if ($option['check_me'] && !is_user_logged_in()) {
         require_once dirname(__FILE__) . '/src/AipBase.php';
         $client = new \Luffy\TextCensor\AipBase($option['app_id'],
 $option['api_key'], $option['secret_key']);
         $res =
 $client->textCensorUserDefined($comment_data['comment_content']);
         if ($res['conclusionType'] == 2) {
             wp_die("评论内容" . $res['data'][0]['msg'] . ",请重新评论");
         } elseif (in_array($res['conclusionType'], [3, 4])) {
             add_filter( 'pre_comment_approved' , '__return_zero');
         }
     }
     return( $comment_data );
 }
 add_filter('preprocess_comment', 'bdtc_refused_comments');
 ```

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


More information about the wp-trac mailing list