WordPress.org

Make WordPress Core

Ticket #11286: new-function-idea.diff

File new-function-idea.diff, 739 bytes (added by miqrogroove, 6 years ago)

Proposal for wp_forbid() to be used instead of top-of-file 500 status

  • functions.php

     
    25442544        wp_die( $html, $title, array('response' => 403) ); 
    25452545} 
    25462546 
     2547/** 
     2548 * Kill WordPress with a Forbidden permissions error. 
     2549 * 
     2550 * Aliases wp_die() to help break the habit of responding status 500 when 
     2551 * the script is working properly. 
     2552 * 
     2553 * @since 3.0.0 
     2554 * @param string $message Error message. 
     2555 * @param string $title Optional. Error title. 
     2556 */ 
     2557function wp_forbid( $message, $title = '') { 
     2558        wp_die( $message, $title, array('response' => 403) ); 
     2559} 
    25472560 
    25482561/** 
    25492562 * Kill WordPress execution and display HTML message with error message.