I’m not sure why it does’t work for you, but the following works in the file wp-content/test.php
:
<?php
// doesn't make difference to have this or not, for the rest to work
define( 'WP_USE_THEMES', false );
require( $_SERVER['DOCUMENT_ROOT'] .'/wp-load.php' );
function my_function()
{
return 'hello world';
}
$value = my_function();
update_option( 'my_option', $value );
var_dump( get_option( 'my_option' ) );