I'm trying to show an alert to the screen when a form is submitted showing the current logged in user's name. I know I need to include the wp-load.php
file but whenever I do that like this:
<?php
include('../../../wp-load.php');
global $current_user;
$current_user = wp_get_current_user();
echo "<script type='text/javascript'>alert('$current_user');</script>";
?>
Upon my form submission I get the whole:
This page isn't working example.com is currently unable to handle this request. HTTP ERROR 500
How am I supposed to resolve this?