PostFilter by CustomField
marcesepu opened this issue · 2 comments
marcesepu commented
Hi Guys,
I wanna retrieve custom post type records by a custom field, someone know how do it?
tks in advance
Blackcat156 commented
/// <summary>
/// reader CustomFields
/// </summary>
/// <param name="PostId"></param>
internal static void ModifyCustomFields(String PostId)
{
var client = new WordPressClient(StaticValue.LocalUser);
Post GetPost = client.GetPost(Convert.ToInt32(PostId));
CustomField[] customField = GetPost.CustomFields;
if (customField != null)
foreach (CustomField Single in customField) {
Console.WriteLine(Single.Id);
Console.WriteLine(Single.Value);
Console.WriteLine(Single.Key);
}
else
Console.WriteLine("CustomFields Null");
}
marcesepu commented
Thanks Blackcat156,
I need retrive post using PostFilter by a custom field, Is it posible?