Ok, tengo problemas para vincular un formulario de comentarios para que publique comentarios en mi Wordpress CMS.
Aquí está el HTML de mi página de publicaciones:
<h1>Leave a Reply ⩤</h1> <form id="form" method="POST"> <input type="text" name="FIRSTNAME" class="name" placeholder="Enter first name.."> <textarea id="subject" name="subject" placeholder="Write a comment.."></textarea> <input type="submit" value="Submit" id=""> </form> </div>y el JS:
var id = JSON.parse(findQuery("id")); fetch(`https://www.someurl.com/wp-json/wp/v2/comments`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ post: id, author_name: "X", author_email: "x@gmail.com", content: "test post" }), }) .then((response) => response.json()) .then((data) => { console.log(data); }); } postComment();¿Apreciaría enormemente cualquier ayuda con esto?