Ajax with plugins returns 0

You can turn your AJAX requests into a REST endpoint to get rid of this common 0 response. All you have to register 2 REST routes for your requests: add_action( ‘rest_api_init’, function () { //Path to approve comment register_rest_route( ‘john_doe/v2’, ‘/approve_comment/’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘approve_my_comment’ ) ); // Path to delete comment … Read more

What would I need to write into a custom plugin in order to add a switch for a custom string of CSS to the edit page?

This code should do the trick. Put this in your functions.php file. function add_custom_css_meta_box() { add_meta_box( ‘custom-css’, ‘Custom CSS’, ‘post_meta_checkbox’, ‘page’, ‘side’ ); } add_action(‘add_meta_boxes’, ‘add_custom_css_meta_box’); function post_meta_checkbox($post) { $checkbox = get_post_meta($post->ID, ‘custom-css’, true); $checked = false; if($checkbox == ‘true’) { $checked = true; } ?> <p> <label>Tick this for custom CSS</label><br /> <input type=”checkbox” … Read more