python-wordpress-xmlrpc icon indicating copy to clipboard operation
python-wordpress-xmlrpc copied to clipboard

How to add post_meta ?

Open Emad-AiDev opened this issue 10 years ago • 5 comments

Hello Max,

Hope you are fine and everything is ok. Big Thanks for great code.

I am using your code in my WP but struggling to find a way to post meta for my posts. Indeed I am using Yoast SEO plugin and I need a way to be able to fill the content of it in my post. What I need is a way to use post_meta , as yoast_wpseo_focuskw ?

Any idea how the code look like ?

Thank you,

Emad-AiDev avatar May 04 '15 15:05 Emad-AiDev

Have you taken a look at the examples in the docs? http://python-wordpress-xmlrpc.readthedocs.org/en/latest/examples/posts.html#custom-post-types contains sample code for deal with post meta fields; even though the title says Custom Post Types, the same technique applies to the standard 'post' and 'page' types as well.

maxcutler avatar May 04 '15 15:05 maxcutler

Dear max I can not understand your reply. This topic is also necessary for me. Please help me the way to fill out the seo keyword to Yoast Seo Plugin page post. Any code ideal? Thanks

yukatat avatar Jun 14 '18 08:06 yukatat

Have a look at your wp database and you will understand how wp stores meta data and why @maxcutler link to docs is your answer.

n3storm avatar Jun 14 '18 09:06 n3storm

Dear n3strom. thank you. I have done it with your suggestion: by follow script: post.custom_fields = [] post.custom_fields.append({ 'key': '_yoast_wpseo_focuskw', 'value': 'ABC' })

yukatat avatar Jun 19 '18 08:06 yukatat

Cheers!

Anyway this should be further explained in documentation.

Don't forget to close the ticket!

n3storm avatar Jun 19 '18 08:06 n3storm