It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center。
已关闭8年。
我想知道如何以编程方式在WordPress中为大约七个不同的帖子创建帖子?
我试过了:
它什么也没显示?
已关闭8年。
我想知道如何以编程方式在WordPress中为大约七个不同的帖子创建帖子?
我试过了:
<div class="demo">
<?php global $user_ID;
$new_post = array(
'post_title' => 'My New Post',
'post_content' => 'Lorem ipsum dolor sit amet...',
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_author' => $user_ID,
'post_type' => 'post',
'post_category' => array(0)
);
$post_id = wp_insert_post($new_post); ?>
</div>
它什么也没显示?
最佳答案
global $user_ID;
$new_post = array(
'post_title' => 'My New Post',
'post_content' => 'Lorem ipsum dolor sit amet...',
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_author' => $user_ID,
'post_type' => 'post',
'post_category' => array(0)
);
$post_id = wp_insert_post($new_post);
关于php - 如何以编程方式在WordPress中创建帖子,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14605868/