0
可能嗎?還是有沒有其他的方式來做到這一點沒有xml-rpc?使用xml-rpc按自定義字段搜索文章
可能嗎?還是有沒有其他的方式來做到這一點沒有xml-rpc?使用xml-rpc按自定義字段搜索文章
是的,這是可能的,但你必須編寫自己的XML-RPC方法。
例如:
add_filter('xmlrpc_methods', 'my_add_xmlrpc_methods');
//this function adds new xml-rpc method
//my.search_posts - name of xml-rpc method
//search_posts_by_custom_field - name of the function that should proccess my.search_posts method call
function my_add_xmlrpc_methods($methods) {
$methods['my.search_posts'] = 'search_posts_by_custom_field';
return $methods;
}
//this function actually search posts
function search_posts_by_custom_field($args) {
//authenticate user
//run search DB query
//return results
}