【问题标题】:Simple Wordpress form submit throws 404 when inputting numeric in input field在输入字段中输入数字时,简单的 Wordpress 表单提交抛出 404
【发布时间】:2015-02-20 21:45:41
【问题描述】:

我在测试我们的一个 Wordpress 应用程序时发现了一个奇怪的错误。

我有一个带有输入字段的表单,如果我在输入文本中的任意位置键入诸如“3”之类的数字,Wordpress 将抛出 404:

<input name="author" type="text" />

如果我将 name 属性从 author 更改为其他任何内容,它就可以正常工作:

<input name="bob" type="text" />

我不是 Wordpress 专家,甚至不是 PHP 开发人员,所以如果这是微不足道的,我深表歉意。我已经从这个 PHP 页面中删除了所有可能的内容。这里是否有一些 Wordpress 魔术,其中“作者”是某种保留字?这是整个 PHP 文件(标题是一个简单的导航栏,页脚只是调用 wp_footer()....):

<?php
/**
 * Template Name: MyTemplate
 */

get_header();

    if(isset($_POST['submitted'])):
        echo "<H4>Submitted!</H4>";
    else:
?>

    <form id="my-form" action="<?php the_permalink(); ?>" method="post">
        <input name="author" type="text" /><br/><br/>

        <input type="hidden" name="submitted" id="submitted" value="true" />
        <input type="submit" value="Submit"/>
    </form>

<?php
    endif;
get_footer();

【问题讨论】:

  • 我应该补充一点,这几乎是使用 Vagrant (github.com/Varying-Vagrant-Vagrants/VVV) 安装的 Wordpress 的基本安装,唯一的第三方插件是“高级自定义字段”。我禁用了自定义字段插件,它没有任何效果。这很奇怪。

标签: wordpress forms http-post


【解决方案1】:

好的哇..所以看起来表单帖子中有保留字:

http://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms

很抱歉提出这样一个新手问题。

【讨论】:

    猜你喜欢
    • 2011-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-01
    • 2021-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多