Make WordPress Core

Opened 5 years ago

Closed 2 years ago

#49684 closed defect (bug) (invalid)

Why the wp_die() method corresponds to different styles in different topics?

Reported by: shenyanzhi's profile shenyanzhi Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

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.

// 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');

Change History (4)

#1 @mukesh27
5 years ago

  • Focuses ui css removed
  • Summary changed from Why the wp_die() method corresponds to different styles in different topics? to Why the wp_die() method corresponds to different styles in different topics?
  • Version 5.3.2 deleted

#2 follow-up: @SergeyBiryukov
5 years ago

  • Description modified (diff)
  • Keywords reporter-feedback needs-screenshots added; dev-feedback removed

Hi there, welcome to WordPress Trac! Thanks for the report.

Could you provide the steps to reproduce the issue on a clean install?

It's not quite clear what the issue is, or what is the expected result. Some screenshots would also be helpful.

#3 in reply to: ↑ 2 @shenyanzhi
5 years ago

Replying to SergeyBiryukov:

Hi there, welcome to WordPress Trac! Thanks for the report.

Could you provide the steps to reproduce the issue on a clean install?

It's not quite clear what the issue is, or what is the expected result. Some screenshots would also be helpful.

Thanks, close this ticket, I think this should be related to the theme, you can customize the error-page

#4 @SergeyBiryukov
2 years ago

  • Keywords reporter-feedback needs-screenshots removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Thanks for the follow-up!

Note: See TracTickets for help on using tickets.