【问题标题】:Inserting data into a 'custom post type' table from the front end从前端将数据插入“自定义帖子类型”表
【发布时间】:2011-03-16 10:40:50
【问题描述】:

嘿,我需要制作一个 wordpress 插件来记录来自联系表单的所有电子邮件。我正在考虑使用“自定义帖子类型”,以便管理员可以查看管理区域中的所有电子邮件。

我可以手动将数据插入此表吗?我正在考虑编写一个脚本,在发送电子邮件时保存电子邮件。

【问题讨论】:

    标签: php sql wordpress


    【解决方案1】:

    点点滴滴,

    您可以创建自定义帖子类型,然后需要使用 wp_insert_post 函数 (http://codex.wordpress.org/Function_Reference/wp_insert_post) 才能从前端发送信息。

    因此您的攻击计划是使用 register_post_type (http://codex.wordpress.org/Function_Reference/register_post_type) 创建您的 CPT,然后在您的插件中将 wp_insert_post 函数的“post_type”参数设置为您创建的 CPT 的名称。

    【讨论】:

      【解决方案2】:

      您应该将电子邮件存储在数据库中并进行查询。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-01-03
        • 2017-06-28
        • 2021-12-25
        • 2021-03-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多