I have created my own custom forms plugin in which I have created a form and after submitting I get "Sorry, no posts matched your criteria". The strange thing is when I added form to other 2 pages its working fine.
This question already has answers here: Page returns 404 with POST variables, but not without (2 answers) Closed 5 years ago.I have created my own custom forms plugin in which I have created a form and after submitting I get "Sorry, no posts matched your criteria". The strange thing is when I added form to other 2 pages its working fine.
Share Improve this question asked Jul 15, 2019 at 13:21 Abhilash NarayanAbhilash Narayan 297 bronze badges 1- This sounds like something you'll have to debug yourself, sorry. How are you submitting the form - where are you submitting it to, a REST API endpoint? What's the difference between the pages where it works and where it doesn't? Can you watch the submission in your browser debug tools to see any difference between the pages that work and the one that doesn't? Can you add code to the code that's handling the form submission in the back end to see what's different? – Rup Commented Jul 15, 2019 at 14:09
1 Answer
Reset to default 0I've finally figured out the problem. All the code, in all it's variations was fine and works, except for one tiny thing. The variable '$name' is used by the WordPress system to display the blog name, and as I was using that as my variable for the name field on my form it was causing issues. Who knew.
Anyway, I simply changed it to use '$fullName' and changed the id and name attributes on the form to 'full-name' and everything worked great.