rest api wordpress creating a post with specific categories using c#

Viewed 9

I am trying to add categories to my post use the module / package wordpressPCL and I can not seem to work it out does anyone have an idea on how to create posts with specific categories set.

error is that it doesn't accept an integer but the id is the integer my code.

private async Task mysite()
        {
            int[] genres = { 5 };
            var client = new WordPressClient("https://mysite/wp-json/");
            client.Auth.UseBasicAuth("user", "password");
            var post = new Post()
            {
                Title = new Title(textBox1.Text),
                Content = new Content(textBox2.Text),
                Categories = new Categories(genres)
            };
            await client.Posts.CreateAsync(post);
 
 
        }

ERROR IS ON LINE 10

First time using the library any help will be appreciated

0 Answers
Related