【问题标题】:Is it possible to feed data from a table to wordpress?是否可以将表格中的数据提供给 wordpress?
【发布时间】:2019-06-07 21:27:42
【问题描述】:

我正在开发一个类似存档的 wordpress 网站。现在我正在考虑如何加快内容上传过程。

通常,您需要先通过 wp 后端注册每个人,然后将一个或多个项目与该人相关联。我要问的是,您是否可以自动化为每个人手动添加新条目的过程。我在 Excel 表中有自定义“人”帖子类型的数据。有没有插件或其他方法可以加快速度?

谢谢!

【问题讨论】:

    标签: wordpress plugins backend


    【解决方案1】:

    /* 编辑 */

    刚刚找到这个插件。您可以从 JSON 导入到 Post

    https://wordpress.org/plugins/json-importer/

    +

    How to Export Excel to JSON

    /* 编辑结束 */

    不知道有没有这个插件。

    但我会走另一条路。您可以创建一个 php 文件并使用 wp_insert_post() 插入来自 JSON 或 CSV 的信息。

    // Create post object
      $my_post = array();
      $my_post['post_title'] = 'Person Name';
      $my_post['post_content'] = 'Information about Person.';
      $my_post['post_status'] = 'publish';
      $my_post['post_author'] = 1;
      $my_post['post_category'] = array(8,39);
    
    // Insert the post into the database
      wp_insert_post( $my_post );
    

    https://developer.wordpress.org/reference/functions/wp_insert_post/

    可能有帮助的答案:

    https://stackoverflow.com/a/34435434/10909061

    https://stackoverflow.com/a/19187094/10909061

    【讨论】:

      猜你喜欢
      • 2021-09-19
      • 1970-01-01
      • 2019-03-14
      • 2020-06-21
      • 2014-07-14
      • 1970-01-01
      • 2017-05-17
      • 1970-01-01
      • 2013-06-25
      相关资源
      最近更新 更多