wordpress - 使用 wp_insert_post 将页面内容设置为 Elementor 模板
问题描述
我想使用 wp_insert_post 创建一个页面并将其内容设置为 Elementor 页面,并将内容设置为 Elementor 模板。我会将其传递给“post_content”参数吗?
解决方案
/* you can use below code to add content when page create */
$new_page = array(
'post_type' => 'page',
'post_title' => 'hello',
'post_content' => 'hello page content',
'post_status' => 'publish',
'post_author' => 1,
);
$new_page_id = wp_insert_post($new_page);
推荐阅读
- python - 无法从 newegg.com 的 price-save-percent 容器中提取文本
- python - python中的2D和3D频谱图
- r - R:阶乘的尾随零数
- spring-boot - 创建类路径资源中定义的名称为“entityManagerFactory”的bean时出错:模式验证:缺少表[association_value_entry]
- java - Java:为什么函数的 ArrayList 参数会影响不同的 ArrayList
- javascript - Reactjs 让一个组件可以被其他组件控制的最佳实践?
- php - 在用户中止匹配之前执行 SQL 查询
- android - Android - API 级别 21 中的日期
- matlab - 从与中心线相切的矩阵中提取点
- java - Hibernate - 保存方法的返回值而不是字段