header( 'Allow: POST'
);
header( "
$protocol 405 Method Not Allowed"
);
header( 'Content-Type: text/plain'
);
exit;
}/** Sets up the WordPress Environment. */
require __DIR__ . '/wp-load.php';
nocache_headers();
$comment =
wp_handle_comment_submission( wp_unslash( $_POST ) );
if ( is_wp_error( $comment ) ) { $data =
(int) $comment->
get_error_data();
if ( !
empty( $data ) ) { wp_die( '<p>' .
$comment->
get_error_message() . '</p>',
__( 'Comment Submission Failure'
),
array
( 'response' =>
$data,
'back_link' => true,
) );
}