• Scenario: A real user exists as a user, but there is a co-author which is not real (CAP). CAP needs to be created during post. All actions are accomplished via XML_RPC.

    While creating the CAP I get an error when attaching the term.id to the guest-author: “Server returned a fault exception: [401] Sorry, one of the given taxonomies is not supported by the post type.”

    I have created the CAP post using the “guest-author” post-type and the term using the “author” taxonomy.

    In the DB I do not see an entry in the wp_term_relationships table to link the 2 objects (presumably due to the above error).

    Note: Creating a CAP via the dashboard is successful.

    Here’s the unusual kicker…
    I am doing this using VB.net/C# and the WordPressSharp library (https://github.com/abrudtkuhl/WordPressSharp).

    For the record, I can attach terms (category and tags) to a default post with post-type “post”. So, I do not believe there is an issue with attaching a term to a post, normally, using the library.

    I am including the basics of the VB code and the XML.

    Any help sorting out why I am getting this error will be greatly appreciated.

    Thank you

    Code (main):

    'define post and term values
    Dim cap_display_name = "John Doe"
    Dim cap_first_name = "John"
    Dim cap_last_name = "Doe"
    Dim cap_user_login = "john-doe"
    Dim cap_user_email = "[email protected]"
    Dim cap_name = "john-doe"
    Dim guest_author_post_name = "cap-john-doe"
    
    Dim customFields() as CustomField = CreateFields()
    ''Breakout of customFields() essentialy, a hash-array -->
    'customField 0: key: "cap-display_name", value: "John Doe"
    'customField 1: key: "cap-first_name", value: "John"
    'customField 2: key: "cap-last_name", value: "Doe"
    'customField 3: key: "cap-user_login", value: "john-doe"
    'customField 4: key: "cap-description", value: "Created via XML-RPC"
    'customField 5: key: "cap-user_email", value: "[email protected]"
    
    'instantiate WP client
    Dim config As New WordPressSiteConfig() With {
    	 .BaseUrl = wpURL,
    	 .BlogId = "3",
    	 .Username = username,
    	 .Password = password
    }
    Dim client As New WordPressClient(config)
    
    'Create guest-author post
    Dim post As New Post() With {
    		.PostType = "guest-author",
    		.Title = cap_display_name,
    		.Name = guest_author_post_name,
    		.PublishDateTime = Now(),
    		.CustomFields = customFields,
    		.Status = "publish"
    	}
    Dim id As Integer = client.NewPost(post)
    
    'Create the term for the author
    Dim aid as Interger
    Dim capTerm as Term
    capTerm.Taxonomy = "author"
    capTerm.Name = cap_user_login
    capTerm.Slug = guest_author_post_name
    capTerm.Description = String.Format("{0} {1} {2} {3} {4} {5}", cap_display_name, cap_first_name, cap_last_name, cap_user_login, chkEmail, id)
    aid = client.NewTerm(capTerm)
    capTerm.Id = aid
    
    'Add the associated term and metadata
    Dim postCAP As New Post()
    postCAP.Id = id
    postCAP.Terms = capTerm
    client.EditPost(postCAP)

    XML export (bits):

    'Post
    	<item>
    		<title>John Doe</title>
    		<link>https://mypress.com/?post_type=guest-author&p=1413</link>
    		<pubDate>Sun, 11 Oct 2015 16:55:07 +0000</pubDate>
    		<dc:creator><![CDATA[mjacobsen]]></dc:creator>
    		<guid isPermaLink="false">https://mypress.com/?post_type=guest-author&p=1413</guid>
    		<description></description>
    		<content:encoded><![CDATA[]]></content:encoded>
    		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
    		<wp:post_id>1413</wp:post_id>
    		<wp:post_date>2015-10-11 16:55:07</wp:post_date>
    		<wp:post_date_gmt>2015-10-11 16:55:07</wp:post_date_gmt>
    		<wp:comment_status>closed</wp:comment_status>
    		<wp:ping_status>open</wp:ping_status>
    		<wp:post_name>cap-john-doe</wp:post_name>
    		<wp:status>publish</wp:status>
    		<wp:post_parent>0</wp:post_parent>
    		<wp:menu_order>0</wp:menu_order>
    		<wp:post_type>guest-author</wp:post_type>
    		<wp:post_password></wp:post_password>
    		<wp:is_sticky>0</wp:is_sticky>
    		<wp:postmeta>
    			<wp:meta_key>cap-display_name</wp:meta_key>
    			<wp:meta_value><![CDATA[John Doe]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key>cap-first_name</wp:meta_key>
    			<wp:meta_value><![CDATA[John]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key>cap-last_name</wp:meta_key>
    			<wp:meta_value><![CDATA[Doe]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key>cap-user_login</wp:meta_key>
    			<wp:meta_value><![CDATA[john-doe]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key>cap-description</wp:meta_key>
    			<wp:meta_value><![CDATA[Created via XML-RPC]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key>cap-user_email</wp:meta_key>
    			<wp:meta_value><![CDATA[[email protected]]]></wp:meta_value>
    		</wp:postmeta>
    	</item>
    
    	'Term
    	<wp:term><wp:term_id>1325</wp:term_id><wp:term_taxonomy>author</wp:term_taxonomy><wp:term_slug>cap-john-doe</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[john-doe]]></wp:term_name><wp:term_description><![CDATA[John Doe John Doe john-doe [email protected] 1413]]></wp:term_description></wp:term>

    https://www.ads-software.com/plugins/co-authors-plus/

  • The topic ‘XML-RPC error "…one of the given taxonomies is not supported by the post type"’ is closed to new replies.