Skip to content

Instantly share code, notes, and snippets.

@peterwilsoncc
Created September 12, 2023 23:22
Show Gist options
  • Save peterwilsoncc/87160c24a252d211cd9736ed57609d8c to your computer and use it in GitHub Desktop.
Save peterwilsoncc/87160c24a252d211cd9736ed57609d8c to your computer and use it in GitHub Desktop.
<?php
/**
* Trigger Error mini plugin re: escaping.
*
* Tested with https://github.com/WordPress/wordpress-develop/pull/5175 checked out.
*
* @wordpress-plugin
* Plugin Name: Trigger Error mini plugin re: escaping.
*/
add_action(
'init',
function() {
$user_input = $_GET['user_input'];
if ( ! is_array( $user_input ) ) {
$message = "\$user_input expects an array, '$user_input' given.";
wp_trigger_error( __FUNCTION__, $message );
// wp_trigger_error( __FUNCTION__, esc_html( $message ) );
// wp_trigger_error( __FUNCTION__, esc_html( esc_html( $message ) ) );
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment