wp_update_post onclick button using ajax
No no no! Never POST or link directly to a custom PHP file – WordPress won’t be loaded, and to load it manually yourself means making huge assumptions about the file hierarchy. Use the ajax API, which exists specifically for this reason: $.ajax({ url: “<?php echo esc_js( admin_url( ‘admin-ajax.php’ ) ) ?>”, type: “POST”, data: … Read more