dongyi1996 2019-06-14 18:40
浏览 53

动态添加使用postmeta进行内容块的WP页面/内容?

I am trying to bulk insert Wordpress pages into database directly. I feel like I used to just be able to insert into wp_posts, with post_content as the page content.

However, this theme/setup/new WP has the content sections in a sub-section of the page builder, and it's using Title and Caption for each content section.

I tried manually adding a section, and see what SQL inserts are done, and I can just replicate that. But not sure why they're not working when I do.

I'm not using any Native WP functions as of right now. Just PHP to insert SQL.

I tried adding post_meta entries to just add a content section, but not sure that random string behind field_XXXXXXX, and if thats required. When I added the below SQL, they didn't show up in backend nor front end.

I just need to be able to dynamically create a page in wp_post, and auto-add wp_postmeta entires for each content paragraph (title, content) for each one. But either I'm doing something wrong with the wp_postmeta queries?

Thoughts? Is there a plugin for this? or a more direct native approach?

Tried inserting SQL directly. Not working.

INSERT INTO `wp_postmeta` (`meta_id`, `post_id`, `meta_key`, `meta_value`) VALUES
(24748, 274, 'post_content_1_title', 'test4'),
(24749, 274, '_post_content_1_title', 'field_5cf6a56fecee5'),
(24750, 274, 'post_content_1_caption', 'test4content_goes_here'),
(24751, 274, '_post_content_1_caption', 'field_5cf6a58decee6'); 

I expect the insert SQL to successful insert a Content block of TITLE and CONTENT into my Wordpress Page, just from an SQL insert. Both Page and content sections need to be done from php/mysql query.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?