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.
Related Posts:
- Using Ajax with a Class file
- Delete row of custom table in WordPress using AJAX
- Minimal WordPress load for only `get_option` to work (because ajax…)
- Ajax with OOP doesn’t work
- Ajax Request not coming back to class
- Cannot update my options using wp_ajax
- How to use get_option() without any filter?
- How to make get_theme_mod work with AJAX in the customizer preview
- Why Does WordPress not output admin-ajax.php path by default?
- Exposing data using a custom WordPress API
- Save & Reset button in theme-option with Ajax (without refresh)
- Retrieve JSON file from JS trough php
- update_option is not saving an array, but saving the string ‘Array’
- update_option in WordPress AJAX
- wp_ajax handler with multiple class instances
- How to perform a frontend HTTP call with AJAX when plugin save the new settings?
- How to load dynamic option with ajax
- WordPress Select Option Load Custom Fields
- How to implement AJAX within a class storing shortcode atts as class variables
- Jquery wrap permalink in a data-attribute?
- Class called in template, AJAX not registering
- Cannot access class properties from ajax call in wpordrpess
- AJAX call in backend results in empty update_option
- Using AJAX for dynamic settings pages
- Why can wordpress not find the actions I add in my constructor?
- using Ajax: call to undefined function get_option
- register_setting and AJAX?
- Class property not visible inside ajax callback function?
- How to get data with Select AJAX PHP
- PHP “php://input” vs $_POST
- Google Maps API throws “Uncaught ReferenceError: google is not defined” only when using AJAX
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- How to solve the error “SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.” in IE
- Show spinner GIF during an $http request in AngularJS?
- Refresh HTML Page in Browser Automatically on Timer – Every 15 Min
- JavaScript implementation of Gzip
- jQuery: Performing synchronous AJAX requests
- ASP.NET MVC controller actions that return JSON or partial html
- jQuery’s .on() method combined with the submit event
- Ajax takes 10x as long as it should/could
- How to get the Date Format and Time Format settings for use in my template?
- How to check if I am in admin-ajax.php?
- Should all plugins be encapsulated in a Class?
- Add multiple custom fields to the general settings page
- Best way to end WordPress ajax request and why?
- How to load wp_editor() through AJAX/jQuery
- Plugin Form Submission Best Practice
- How to cache json with wp-super cache
- Load minimum WordPress environment
- Why use wp_send_json() over echo json_encode()?
- Why use admin-ajax.php and how does it work?
- How to get a unique nonce for each Ajax request?
- Using classes instead of global functions in functions.php
- Open a Thickbox with content trough AJAX
- Initialize TinyMCE editor / visual editor after AJAX insert
- Why not register shortcodes if is_admin dashboard?
- Using jQuery to delete data stored in wp_options
- WordPress AJAX with Axios
- Why is die() used at the end of function that handles an Ajax request?
- Why might a plugin’s ‘do_shortcode’ not work in an AJAX request?
- Making my AJAX powered WordPress Crawlable
- Is there a JavaScript API? How to access public and private data in JS?
- Get Previous & Next posts by Post ID
- failed to load wp-admin/admin-ajax.php
- Using Backbone with the WordPress AJAX API
- Ajax in a settings page (update_option is undefined)
- How to pass data parameter to ajax action function handler
- WordPress Ajax Data Security
- Displaying PHP Errors from admin-ajax.php
- wp_set_auth_cookie() doesn’t work in Ajax call
- gettext does not translate when called in ajax
- Execute one AJAX request after another AJAX request finished
- WP-AJAX vs WP REST API: What to use for requests to the website from outside?
- Ajax and autocomplete
- How to add to cart via AJAX Woocommerce [closed]
- Nonces and Cache
- SSL breaks customizer: page isn’t returned from ajax
- Why is a 500 error generated by admin-ajax.php not going into the Apache error log?
- Are ‘wp_ajax’ and ‘wp_ajax_nopriv’ exclusive to authenticated and non-authenticated users?
- How to HTML5 FormData Ajax
- Creating Ajax backend for Specialised Page Template? Should admin-ajax.php be used?
- admin-ajax.php vs Custom Page Template for Ajax Requests
- How to override WP_DEBUG for Ajax responses?
- Stop admin-ajax?
- redirect out of wp-admin, without losing admin-ajax.php
- Call to undefined function add_action()
- Where should I use get_option in a plugin
- How to Create a Custom WordPress Install Package?
- Is it safe to assume that a nonce may be validated more than once?
- When adding a custom REST endpoint, where do you put the endpoint function, and where do you put the function registration call?
- Including WordPress in RESTful API
- Multiple ajax nonce requests
- Get posts with ajax
- How To Provide Sub-Blogs Their Own Domain Names?
- admin-ajax.php doesn’t work when using POST data and Axios
- How to call a PHP function with Ajax when the user clicks a button
- REST API endpoint for elasticpress autosuggest
- Ajax for non-logged-in users
- Is it possible to change the attributes of a registered style or script before it fires?