Found the issue. First I added
ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
along the
define('WP_DEBUG', TRUE);
in my wp-config.php
, this writes the errors, notices and warnings in the error_log.txt
in the root folder (I don’t know why I haven’t thought of that in the first place).
Then I saw the errors – I used json_decode
instead of wp_json_encode
to encode my settings as a string before storing it in my option.
There is this weird issue of name being not of the subpage, but I’ll get to that now.
Thanks to TheDeadMedic for suggesting the error_message()
method of finding out if the code works or not. This will help with any AJAX debugging in the future.