使用php更改Wordpress内容字段
在我的一个项目中,我使用ACF(高级自定义字段),但由于一些限制,我不能只输出ACF,我需要将输出输入wordpress内容字段 事实上,我有一个解决方案,但它也带来了一些不便,基本上它会触发一堆插件,这些插件会在savepost上触发 我运行的代码如下使用php更改Wordpress内容字段,php,wordpress,post,post-meta,Php,Wordpress,Post,Post Meta,在我的一个项目中,我使用ACF(高级自定义字段),但由于一些限制,我不能只输出ACF,我需要将输出输入wordpress内容字段 事实上,我有一个解决方案,但它也带来了一些不便,基本上它会触发一堆插件,这些插件会在savepost上触发 我运行的代码如下 <?php ob_start(); ?> a big template is here <?php $contents = ob_get_contents(); ob_end_clean(); ob_end_flus
<?php
ob_start();
?>
a big template is here
<?php
$contents = ob_get_contents();
ob_end_clean();
ob_end_flush();
?>
<?php
$post = array();
$post['ID'] = $postnummer;
$post['post_content' ] = $contents;
wp_update_post( $post );
?>
非常感谢您的帮助为什么不使用?它是专门为原始帖子内容的扩展而设计的
update_post_meta( $post_id, 'wordpress_content', $contents );