hakuna matata

Рейтинг
223
Регистрация
14.01.2012
sparsame:
thank! until it turns custom_field, but thank you for direction.

Look now took from your poster on xmlrpc, add your custom field:

 <? Xml version = "1.0"?> 
<MethodCall>
<MethodName> metaWeblog.newPost </ methodName>
<Params>
<Param> <value> <array> <data>
<Value> <int> 0 </ int> </ value>
<Value> <string> admin </ string> </ value>
<Value> <string> passwd </ string> </ value>
<Value> <struct>
<Member> <name> title </ name> <value> <string> hello world title2 </ string> </ value> </ member>
<Member> <name> description </ name> <value> <string> hello world body2 </ string> </ value> </ member>
<Member> <name> dateCreated </ name> <value> <dateTime.iso8601> 20200615T14: 18: 04 </dateTime.iso8601> </ value> </ member>
<Member> <name> mt_allow_comments </ name> <value> <int> 0 </ int> </ value> </ member>
<Member> <name> mt_allow_pings </ name> <value> <int> 0 </ int> </ value> </ member>
<Member> <name> post_type </ name> <value> <string> post </ string> </ value> </ member>
<Member> <name> custom_fields </ name> <value> <array> <data>
<Value> <struct>
<Member> <name> key </ name> <value> <string> thumbnail_external </ string> </ value> </ member>
<Member> <name> value </ name> <value> <string> https: //my_site/image.jpg </ string> </ value> </ member>
</ Struct> </ value>
</ Data> </ array> </ value> </ member>
</ Struct> </ value>
<Value> <boolean> 1 </ boolean> </ value>
</ Data> </ array> </ value> </ param>
</ Params> </ methodCall>

It is formed as follows:

 $ Date = new IXR_Date (time ()); 

$ PostData = [ 'Title' => 'hello world title2',
'Description' => 'hello world body2',
'DateCreated' => $ date,
'Mt_allow_comments' => 0,
'Mt_allow_pings' => 0,
'Post_type' => 'post',
'Custom_fields' => [ [ 'Key' => 'thumbnail_external',
'Value' => 'https: //my_site/image.jpg',
]
]
];


$ Client = new WP_HTTP_IXR_CLIENT ($ url);
$ Client-> debug = false;

if (! $ client-> query ( 'metaWeblog.newPost', array (0, $ login, $ passwd, $ postData, true))) {
echo "err:". $ Client-> getErrorMessage (). "\ T";
return null;
}


---------- Posted 15.06.2020 at 17:38 ----------

sparsame:
- by ID records are added to the database entry the desired url.

If you suddenly want to do so (not clear why), it is possible through the wp-cli more:

usage: wp post meta add <id> <key> [<value>] [--format = <format>] or: wp post meta delete <id> [<key>] [<value>] [--all] or: wp post meta get <id> <key> [--format = <format>] or: wp post meta list <id> [--keys = <keys>] [--fields = <fields>] [- -format = <format>] [--orderby = <fields>] [--order = <order>] [--unserialize] or: wp post meta patch <action> <id> <key> <key-path> ... [<value>] [--format = <format>] or: wp post meta pluck <id> <key> <key-path> ... [--format = <format>] or: wp post meta update <id> <key> [<value>] [--format = <format>]
sparsame:
Отправляю такую xml. Пост создается, без ошибок, но поле с изображением остается пустым..

Если thumbnail_external это custom field, то надо слать их массивом. xml же не руками формируешь, надеюсь?

sparsame:
I send this xml. Fasting is created without errors, but the field with the image remains empty ..

If thumbnail_external this custom field, it is necessary to send them to an array. xml not formiruesh hands, I hope?

Вы опять потоковый парсер json пишете?

Их в гугле полно https://github.com/salsify/jsonstreamingparser

Once again you're streaming parser json?

They are fully in Google https://github.com/salsify/jsonstreamingparser

Sitealert:
Я выиграл олимпиаду.

Вот эту.

Sitealert:
I won the Olympics.

This one.

SeVlad, любой желающий может проверить самостоятельно и сделать выводы.

http://sprunge.us/WQVtfl

Всего: 2166