WordPress.org

Make WordPress Core

Opened 2 weeks ago

Last modified 2 weeks ago

#49684 new defect (bug)

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

Reported by: shenyanzhi Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords: reporter-feedback needs-screenshots
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 (3)

#1 @mukesh27
2 weeks 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
2 weeks 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
2 weeks 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

Note: See TracTickets for help on using tickets.