最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - I am Getting Sorry, no posts matched your criteria on form submit only for certain page

programmeradmin1浏览0评论
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.

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
Add a comment  | 

1 Answer 1

Reset to default 0

I'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.

发布评论

评论列表(0)

  1. 暂无评论