开发者

How to add custom fields for WordPress using Codeigniter RPC

开发者 https://www.devze.com 2023-02-14 13:59 出处:网络
I am using Codeignitor\'s RPC to post to a wordpress blog which is working fine BUT I cannot get the custom fields working. I assume the custom_fields is not correct \"wrapped up\" for the call?

I am using Codeignitor's RPC to post to a wordpress blog which is working fine BUT I cannot get the custom fields working. I assume the custom_fields is not correct "wrapped up" for the call?

 $thePost = array(array('title'  => array('Aston','string'),
                        'description'    => array('this is the description','string'),
                        'wp_author_id'    => array('2','int'),
                        'mt_keywords'    => array('personal finance, money management','string'),
      开发者_开发问答                  'mt_text_more'  => array('<a href="http://www.ibm.com">read more</a>','string'),
                        'categories'    => array(array('Small Business'),'array'),
                        'custom_fields' => array(array('key' => 'image','value' => 'Say Hello'),'struct')),
                 'struct');   


$thePost = array(array('title'  => array('Aston','string'),
                       'description' => array('this is the description','string'),
                       'wp_author_id' => array('2','int'),
                       'mt_keywords' => array('personal finance, money management','string'),
                       'mt_text_more' => array('<a href="http://www.ibm.com">read more</a>','string'),
                       'categories' => array(array('Small Business'),'array'),
                       'custom_fields' => array(
                                            array(
                                              array(
                                               'key' => 'your key', 
                                               'value' => 'value'
                                              ),
                                            'struct')
                                          ),'struct')),
                 'struct');   


Take a look at this thread http://wordpress.org/support/topic/add-custom-fields-to-a-post-using-xml-rpc

Basically it says that you should be using metaWeblog.newPost instead of the wp api.

0

精彩评论

暂无评论...
验证码 换一张
取 消