Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用php更改Wordpress内容字段_Php_Wordpress_Post_Post Meta - Fatal编程技术网

使用php更改Wordpress内容字段

使用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

在我的一个项目中,我使用ACF(高级自定义字段),但由于一些限制,我不能只输出ACF,我需要将输出输入wordpress内容字段

事实上,我有一个解决方案,但它也带来了一些不便,基本上它会触发一堆插件,这些插件会在savepost上触发

我运行的代码如下

<?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 );