我正在使用 wp-insert-post 在 wordpress 中动态创建帖子。该脚本在一个外部文件中,我已经包含了 wp-load.php 文件以使用那里的 wordpress 函数。我的疑问是,在使用 wp-insert-post 功能时,我们可以使用默认参数,但我们如何包含插件使用的参数(在本例中为 Facebook)。
我想设置这个参数:facebook_page_message_box_message
我尝试使用:
$post = array();
$post['post_type'] = 'post';
$post['post_title'] = 'Custom title';
$post['post_content'] = 'Custom content';
$post['post_author'] = '1';
$post['facebook_page_message_box_message'] = 'Custom Title (to be displayed on the Facebook timeline, when the post is published)';
$post_id = wp-insert-post($post);
但这不起作用。我还尝试使用诸如 Wp_set_object_terms 之类的 wordpress 函数,但即使这样也没有用。