WordPress.org

Make WordPress Core

Ticket #10551: 10551-new-functions-proposal.diff

File 10551-new-functions-proposal.diff, 1.9 KB (added by solarissmoke, 3 years ago)
  • wp-includes/functions.php

     
    26932693} 
    26942694 
    26952695/** 
     2696 * Call wp_die() and issue a HTTP 403 Forbidden response code 
     2697 * 
     2698 * @since 3.2 
     2699 * 
     2700 * @param string $message Error message. 
     2701 * @param string $title Error title. 
     2702 * @param string|array $args Optional arguements to control behaviour. 
     2703 */ 
     2704function wp_die_forbid( $message, $title = '', $args = array() ) { 
     2705        $args['response'] = 403; 
     2706        wp_die( $message, $title, $args ); 
     2707} 
     2708 
     2709/** 
     2710 * Call wp_die() and issue a HTTP 404 Not Found response code 
     2711 * 
     2712 * @since 3.2 
     2713 * 
     2714 * @param string $message Error message. 
     2715 * @param string $title Error title. 
     2716 * @param string|array $args Optional arguements to control behaviour. 
     2717 */ 
     2718function wp_die_not_found( $message, $title = '', $args = array() ) { 
     2719        $args['response'] = 404; 
     2720        wp_die( $message, $title, $args ); 
     2721} 
     2722 
     2723/** 
     2724 * Call wp_die() and issue a HTTP 500 Internal Server Error response code 
     2725 * 
     2726 * @since 3.2 
     2727 * 
     2728 * @param string $message Error message. 
     2729 * @param string $title Error title. 
     2730 * @param string|array $args Optional arguements to control behaviour. 
     2731 */ 
     2732function wp_die_error( $message, $title = '', $args = array() ) { 
     2733        $args['response'] = 500; 
     2734        wp_die( $message, $title, $args ); 
     2735} 
     2736 
     2737/** 
    26962738 * Kill WordPress execution and display HTML message with error message. 
    26972739 * 
    26982740 * This is the default handler for wp_die if you want a custom one for your 
     
    27062748 * @param string|array $args Optional arguements to control behaviour. 
    27072749 */ 
    27082750function _default_wp_die_handler( $message, $title = '', $args = array() ) { 
    2709         $defaults = array( 'response' => 500 ); 
     2751        $defaults = array( 'response' => 200 ); 
    27102752        $r = wp_parse_args($args, $defaults); 
    27112753 
    27122754        $have_gettext = function_exists('__');