PHP XML-RPC Posting (Need Help)

Status
Not open for further replies.

dewaforex

Active Member
120
2011
17
0
Hi,

I'm using XML-RPC to make post at wordpress, the problem is I can't find the right field to insert data for "All-In-One SEO Pack".

I tried using fields '_aioseop_title', '_aioseop_description', '_aioseop_keywords' and 'aiosp_title', 'aiosp_description', 'aiosp_keywords' but still didn't working.

Anyone in here know the right field for "All-In-One SEO Pack"? <3
 
8 comments
replace the set_custom_fields funtion from wp-includes/class-wp-xmlrpc-server.php with:
PHP:
    function set_custom_fields($post_id, $fields) {
        $post_id = (int) $post_id;

        foreach ( (array) $fields as $meta ) {
            if ( isset($meta['id']) ) {
                $meta['id'] = (int) $meta['id'];

                if ( isset($meta['key']) ) {
                    update_meta($meta['id'], $meta['key'], $meta['value']);
                }
                else {
                    delete_meta($meta['id']);
                }
            }
            else {
                $_POST['metakeyinput'] = $meta['key'];
                $_POST['metavalue'] = $meta['value'];
                add_meta($post_id);
            }
        }
    }

i didn't tested with latest wp version. This is what i used on one of my blogs and i remember was working
 
Can you tell me the field do you use?
I tried both of this but still not working after edit the class-wp-xmlrpc-server.php
The "All-In-One SEO Pack" is still empty.

PHP:
$customfields=array(
        'key' => 'aiosp_title', 'value' => $title ,
        'key' => 'aiosp_description', 'value' => $title ,
        'key' => 'aiosp_keywords', 'value' => $aio_keywords
);
PHP:
$customfields=array(
        'key' => '_aioseop_title', 'value' => $title ,
        'key' => '_aioseop_description', 'value' => $title ,
        'key' => '_aioseop_keywords', 'value' => $aio_keywords
);
PHP:
    $content = array(
        'title'=>$title,
        'description'=>$body,
        'mt_allow_comments'=>1,  // 1 to allow comments
        'mt_allow_pings'=>0,  // 1 to allow trackbacks
        'post_type'=>'post',
        'mt_keywords'=>$keywords,
        'categories'=>array($category),
        'custom_fields' =>  array($customfields)


    );

by the way, if I saw the function for setting customs field, it was using postid.
is it mean setting customs field only can be done when editing post not new post?
 
Last edited:
by the way, if I saw the function for setting customs field, it was using postid.
is it mean setting customs field only can be done when editing post not new post?
I'm sure you can set custom fields when creating new post with XML-RPC (not only when editing).
 
So it's because of the starting underscore. Good to know that, thanks.

Maybe you can just change every occurrence of these vars in the plugin itself?
 
Status
Not open for further replies.
Back
Top