get_option,intval,datatype

My scripts run if I do:

$config['max'] = 20;

It doesn't run if I use the configuration-value of my plugin like

$config['max'] = get_option('plugin_max');

Also not like

$config['max'] = intval(get_option('plugin_max'));

In every case, if I print $config['max'], it prints

20

I think there must be some stupid datatype-mismatch, but I can't figure out what it could be.

Solution

ok, I have to clear this up and maybe it will help someone later on. The problem was that get_option was undefined because it was called directly in an AJAX-request. I now routed the ajax-requests properly over WPs admin-ajax.php function so that WP-functions are available to the plugin even when called from AJAX. Strangely, while debugging, the function was available, but this might have been while initialising the plugin, which is of course no AJAX-request but entirely server-side and so inside the scope of WP by default.

Thanks for your support!