I'm using the following function to retrieve individual posts from an external server using the WordPress XML-RPC Post API:

    public function get_post() {

        $function_name = "wp.getPost";

        $url = "http://local.wordpress.dev/xmlrpc.php";

        $client = new xmlrpc_client($url);
        $client->return_type = 'phpvals';

        $message = new xmlrpcmsg(
                    new xmlrpcval(0, "int"), //blog_id
                    new xmlrpcval("admin", "string"), //username
                    new xmlrpcval("password", "string"), //password
                    new xmlrpcval("318", "string") //post_id

        $resp = $client->send($message);



If I don't know the post_id of the post I'm wanting to retrieve but I do know a custom meta key value, can I still retrieve the post?

For example, let's say I had a meta_key of misc_id wit ha value of 26. Could I use the XML-RPC WordPress Post API to find a post that matched that or would I have to use MySQL in order to accomplish this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.