PHP XMLRPC for WordPress: Adding meta tags and description

The field for tags is mt_keywords, as reference see this ticket. The field for the category is categories. Important is it, that you have a array for the fields, like $categories[0] = “cat1”; $categories[1] = “cat2”; $tags[0] = “tag1”; $tags[1] = “tag2”; $content[ ‘categories’ ] = $categories; $content[ ‘mt_keywords’ ] = $tags; As reference for … Read more

X-Pingback and XMLRPC

I think that when talking about XMLRPC in the context of wordpress you usually mean to talk about authoring tools utilizing the XMLRPC protocol, and not about the protocol in general. In case of pingbacks and trackbacks the XMLRPC protocol is utelized to send content (comment) to your site by some other entity which is … Read more

Extending xml rpc – best practice

If I have lots of custom methods what is the best approach to handling this? Instead of filtering xmlrpc_methods, you could extend the wp_xmlrpc_server class and set your class as default with the filter wp_xmlrpc_server_class. // Webeo_XMLRPC.php include_once(ABSPATH . WPINC . ‘/class-IXR.php’); include_once(ABSPATH . WPINC . ‘/class-wp-xmlrpc-server.php’); class Webeo_XMLRPC extends wp_xmlrpc_server { public function __construct() … Read more

custom XMLRPC method plus authentication of user & WooCommerce order

I sent it to you on Twitter, but here it is again. I made this little class to help me do XML-RPC faster. abstract class MZAXMLRPC { protected $calls = Array(); protected $namespace = “myxmlrpc”; function __construct($namespace){ $this->namespace = $namespace; $reflector = new ReflectionClass($this); foreach ( $reflector->getMethods(ReflectionMethod::IS_PUBLIC) as $method){ if ($method->isUserDefined() && $method->getDeclaringClass()->name != get_class()){ … Read more

How to enable wpautop for XMLRPC content

So, the default xmlrpc get_post function does not have any nice filters for you to use. The solution: roll your own XML-RPC callback! Hook into xmlrpc_methods and add a custom method, in this case called post_autop. The array key will be the method name, and the value the method callback. <?php add_filter( ‘xmlrpc_methods’, ‘wpse44849_xmlrpc_methods’ ); … Read more

Is there a way to get protected meta fields through any of the available built-in WordPress APIs? (xmlrpc, wp-json)

To me, the simplest solution would be creating additional field in JSON response and populating it with selected post meta: function create_api_posts_meta_field() { // “tribe_venue” is your post type name, // “protected-fields” is a name for new JSON field register_rest_field( ‘tribe_venue’, ‘protected-fields’, [ ‘get_callback’ => ‘get_post_meta_for_api’, ‘schema’ => null, ] ); } add_action( ‘rest_api_init’, ‘create_api_posts_meta_field’ … Read more