Deploy Subcategories with Ajax not working

onclick=”cat_ajax_get(…)” looks for a function in the global Javascript scope. This line: jQuery(document).ready(function($){ hides everything from the global scope. So, this won’t work. You will have to use a completely different technique here. Do not set the onclick attribute. Instead attach the handler from inside your Javascript code: jQuery(document).ready(function($){ var links = $(“.filter a.ajax”); var … Read more

Ajax Function call is always returning 0 in front end(without plugin) [closed]

First things first You have a few errors in your code. The table for terms is called wp_terms instead of wp-terms The query $qry is not correct, the inner query has an invalid WHERE-clause: SELECT term_id as term_id FROM wp_term_taxanomy = ‘category’ should be SELECT term_id as term_id FROM wp_term_taxanomy WHERE taxonomy = ‘category’ Improvement: … Read more

Use ajax without a plugin?

Plugin code is just… code, it can go in a themes functions.php, or a plugin file, there’s no magical or special difference other than the order they’re loaded in, and the API calls are identical, work the same way etc because they’re the same. It’s just how the code is packaged For example, if you … Read more

AJAX call in backend results in empty update_option

I figured it out, when registering with register_setting the second parameter is the name of the settings you will be saving and updating, the parameter is pass in here to whitelist it against being updated outside of the plugin. The AJAX callback is deemed outside of the plugin. My register settings is below and the … Read more

AJAX save options inside class

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 … Read more