Delete data from database using row action

The “admin_action_{$_REQUEST[‘action’]}” hook does not pass any arguments. You would need to get the article_id from the $_REQUEST array. There are also a few other concerns such as: You’re not assigning an action when you call wp_create_nonce(). As Mafnah suggets in their ansewr, you should use $wpdb::delete() as a shortcut for using $wpdb::prepare(). Here’s how … Read more

Custom AJAX Endpoint not returning any result

You need to use the defined namespace as the prefix for the add_action callbacks so that PHP knows which function it is supposed to call. More on this here, add_action in namespace not working The add_actions should look like this then, add_action(‘wp_ajax_ajax_endpoint’, __NAMESPACE__ . ‘\\ajax_endpoint’); add_action(‘wp_ajax_nopriv_ajax_endpoint’, __NAMESPACE__ . ‘\\ajax_endpoint’); When doing development work it is … Read more