Firstly, I know that XML-RPC is designed to send out the raw post data, but I need it to expand shortcodes out. I don't use it for posting so it won't be an issue there, but there are services that are grabbing posts from it and they're getting the shortcodes [] instead of the expanded shortcodes. I'd switch to RSS but I can't. I've expiremented but can't get do_shortcode to work in class-wp-xmlrpc-server.php Thanks.
|
Explanation of the behaviorA shortcode is meant to be processed during runtime (when rendering & displaying a post on the public facing view). It is absolutely not meant to be a pre-processor during saving the post. The receiver simply doesn't have your parser (which is the function processing the shortcode) and therefore will get the raw result. How to "fix" itJust a note upfront: When you're doing this, it won't be reversible. The shortcode will get transformed to whatever it is replaced with and the result will then be saved as post content. You will want to use the
to pre-process the post and replace the shortcode tag with it's actual content. Another option you might want to consider is the or
To grab the shortcode you'll want to use Hooks and XML RPC?I'm not sure if the following works. It is well known that one can extend the XML RPC interface, but it seems that there're options/hooks to alter the returned values (at least it also does query for posts). AS Matthew Murow explains, you could check (in a plugin) if you have an XML RPC request and then intercept during the hook:
This would look similar to this:
|
|||||
|
|
This is not the way the editing methods of XML-RPC implement by WordPress meant to be used. XML-RPC is a publishing protocol and you basically want to break the most basic rule of editing that fetching a file and saving it without modifications will result in exactly the same file. On practical level, you will need to differentiate between users to those that get the "raw" data and those that get the processed one. Once you have done it you can hook on the xmlrpc_prepare_post filter
untetsed, and have no idea if you have to run anything else before calling But what you really should do is declare a new XML-RPC method with the |
|||
|
|
