I created a template on WordPress and I made an html form. It works well in HTML but doesn’t work when used on WordPress. It seems that it doesn’t find my contact-send.php
page and it displays a 404 Error page.
My permalinks were on default and it didn’t work.
Does anyone know how to fix this?
If any of my code is needed, I’ll post it. I just didn’t because I think it’s not a code error once it doesn’t find contact-send.php
.
Use an absolute URL for the target of your form instead of just
action="contact-send.php"
.But unless you have particularly unusual requirements for your contact form, you will likely have better results using one of the many popular contact form plugins like Contact Form 7.
Using a well-maintained plugin ensures stability, and more importantly, security. Don’t reinvent the wheel if you don’t have to.
Your problem can be caused due to 3 reasons.
<?php echo get_template_directory_uri(); ?>/contact-send.php
will solve this problem.contact-send.php
page in the themes folder. This problem can be solve by adding the page to the themes folder..htaccess
file. This can be solved by recreating the code for your .htaccess file fromDashboard
>Permalinks
and paste it in the.htaccess
file in the WordPress root directory.I am giving the explanation in the assumption that your template file is directly in the themes folder.
Add
<?php echo get_template_directory_uri(); ?>/contact-send.php
. When you write contact-send.php only then it don’t find your file which is in your theme. So use this<?php echo get_template_directory_uri(); ?>/contact-send.php
in form action. This change may be helpful.