WordPress.org

Ready to get started?Download WordPress

Forums

Extended API
[resolved] custom post taxonomy (2 posts)

  1. eduardovc
    Member
    Posted 1 year ago #

    I have custom posts with custom taxonomies. I want to create a new custom post in a category. Everything works fine except the link to a custom category. The API says to use 'terms_names', but I don't have explanation about the usage of this variable. The code below:

    'title'=>$title,
    'description'=>$body,
    'mt_allow_comments'=>0,  // 1 to allow comments
    'mt_allow_pings'=>0,  // 1 to allow trackbacks
    'post_type'=>'ad_listing',
    'mt_keywords'=>$keywords,
    'categories'=>array($category),
    
    'terms_names' => array('ad_cat' => 'Audi'),

    http://wordpress.org/plugins/extended-xml-rpc-api/

  2. michaelgrosser
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,
    Just to confirm, are you trying to do this with my extended API plugin or are you using the native XML-RPC method to do this?

    If you're using my plugin, then you'd create a post with wp_create_post() and then use wp_set_post_terms() to assign the post to categories.

    You may be able to use "tax_input" attribute from the create post method to accomplish the same thing. See this page in the codex: http://codex.wordpress.org/Function_Reference/wp_insert_post

    The format you're using above seems to suggest that you're trying to use the native API method and not my plugin.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.