Why do I get error 403 when I try to post on my WordPress? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed yesterday. This post was edited and submitted for review 23 hours ago. Improve this question I developed a WP plugin that has always worked until some times ago. This page is stored in /wp-content/plugins/ folder. This is the code of my PHP page getting posted data: <?php $headers = apache_request_headers(); $zpath =$_SERVER['DOCUMENT_ROOT'].'/wp' ; $post = file_get_contents('php://input'); $data = json_decode($post, true); include_once $zpath . '/wp-config.php'; include_once $zpath . '/wp-includes/wp-db.php'; include_once $zpath . '/wp-includes/pluggable.php'; global $wpdb; print_r($wpdb); die(); ?> I'm using Postman. If I send a request with GET verb, everything works well and I get: wpdb Object ( [show_errors] => [suppress_errors] => [last_error] => [num_queries] => 90 [num_rows] => 0 [rows_affected] => 0 [insert_id] => 0 [last_query] => SELECT option_value FROM wp5k_options WHERE option_name = 'vc_automapped_shortcodes' LIMIT 1 [last_result] => Array ( ) .... If I turn my GET verb to POST, the outcome is the same if I don't send any body in the request. If I send {"a":"hello"} the answer from the server is this (error 403) {"code":"wp_die","message":"<strong>ERRORE:<\/strong> Spiacenti. Si \u00e8 verificato un errore. Assicurati che il browser abbia JavaScript e i cookies abilitati.<br \/><br \/>\n\n","data":{"status":"403"},"additional_errors":[]} I noticed that the problem seems to be the inclusion of wp-config. Without including wp-config I have no errors but the $wpdb object is not initialized. What could this due to? Has anyone changed some folder rights? Or verb rights?

Comment (0)

You’ll be in good company