Open Blackcat156 opened 6 years ago
var client = new WordPressClient(StaticValue.LocalUser); Post GetPost = client.GetPost(Convert.ToInt32(text)); Console.WriteLine(GetPost.Content);
Console.WriteLine(GetPost.MediaItems==null);
//Output true
I have uploaded the picture
Hello, I can't solve the problem. So I use WordPress to output all the ID in the picture and then delete them. I hope to help people who have the same problems with me. You need to put this code anywhere in your WordPress theme output article. He will output all the attachments that are uploaded to this article, ID.
`<?php /**
function echo_first_image ($postID)
{
$args = array(
'order'=> 'ASC',
'post_mime_type' => 'image',
'post_parent' => $postID,
'post_status' => null,
'post_type' => 'attachment'
);
$attachments = get_children( $args );
if ($attachments) {
foreach($attachments as $attachment) {
echo '<div class="imgId">'.( $attachment->ID ).'</div> ';
}
}
} echo_first_image ($postID);
?>`
https://www.xxxxxx.com/wp-json/wp/v2/media/21370 I found that the appendix ID can be obtained through wp-json, which is automatically opened
I want to get all the photo attachments in a published post. https://codex.wordpress.org/XML-RPC_WordPress_API The wp.uploadFile provided by WordPress can't be found in the API How can I get a ID to get all the pictures in the published article post.MediaItems It's always null I want to get the picture ID, thank you!