abrudtkuhl / WordPressSharp

A C# client to to interact with the WordPress XML-RPC API

Home Page:abrudtkuhl.github.io/WordPressSharp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PostFilter by CustomField

marcesepu opened this issue · comments

Hi Guys,

I wanna retrieve custom post type records by a custom field, someone know how do it?

tks in advance

 /// <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");
    }

Thanks Blackcat156,
I need retrive post using PostFilter by a custom field, Is it posible?