$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>php - Handling form actions in Wordpress|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

php - Handling form actions in Wordpress

matteradmin11PV0评论

A non wordpress PHP file has this kind of code:

<form class="someclass" action="page-contact.php" method="post">

But when in WordPress it doesn’t work.

suppose we are here(a WordPress page or a post): www.sample/somepage/

The above page is using the page-contact.php template.

Then the above when the to submit button of the contact form is triggered takes to:

www.sample/somepage/page-contact.php

This generates an error that 404 not found(because that link doesn’t exist). what is the solution so that it(action) works in WordPress?

I tried the solution posted here → How to handle form submission?

  1. But that solution doesn't work.
  2. Even if had worked than which theme author will put an action file in wp-admin because the path is shown their belongs to wp-admin →

action="<?php echo admin_url('admin-ajax.php'); ?>"

In my case, the admin-ajax.php file will be the same template/page file where the swiftmailer code is there with SMTP settings to send an email.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far