For debug purposes in further development, I am trying to add a simple function to a WordPress site and execute it in the Firefox console.
As in https://developer.wordpress.org/reference/functions/add_action/, I put into functions.php
of my OceanWP theme:
add_action( 'hello_world', 'hdt_hello_world' );
function hdt_hello_world($text) {
echo 'Hello World!';
echo $text;
}
Reload the page and try to execute from Firefox Console, getting:
hello_world('Hi!');
Uncaught ReferenceError: hello_world is not defined
<anonymous> debugger eval code:1
Seems I miss the point somewhere... Could you give a hint?