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

EditPost won't change post's format to 'standard'

Open SandReckoner opened this issue 9 years ago • 1 comments

I have been able to use EditPost to change a post's format from 'standard' to 'aside' etc., but cannot change a post with, e.g., 'aside' format to 'standard'.

A sketch of the code I am using is:

from wordpress_xmlrpc import Client, WordPressPost
import wordpress_xmlrpc.methods.posts as wpp

client = Client(...)
post = client.call(wpp.GetPost(N))

post.post_format = 'standard'
post.title = 'visited -- ' + post.title
post.content = 'visited -- ' + post.content
r = client.call(wpp.EditPost(post.id, post))

When I run this code, the post in question was indeed "visited" by changes to title and content. But if the post had format 'aside', then running the code above does not change the format to 'standard'. (Trying None, 0, [] in place of 'standard' on the line above did not work either.)

However, if the post is format 'standard' and I run the code above with the one line changed to

post.post_format = 'aside'

then the post in question does change to format 'aside'.

Is there a trick to using EditPost to change a post's format to standard? Thanks!

SandReckoner avatar Jun 28 '15 02:06 SandReckoner

It looks like this may be a bug on the WordPress side, you are using the library correctly. I'll take a closer look and submit a patch to WordPress if I can determine the cause.

maxcutler avatar Jul 25 '15 18:07 maxcutler