The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::wp::xmlrpc - A thin layer of CLI over WordPress XML-RPC API

VERSION

This document describes version 0.003 of App::wp::xmlrpc (from Perl distribution App-wp-xmlrpc), released on 2017-04-24.

SYNOPSIS

This module is meant to be used only via the included CLI script wp-xmlrpc. If you want to make XML-RPC calls to a WordPress website, you can use XMLRCCP::Lite directly, e.g. to delete a comment with ID 13:

 use XMLRPC::Lite;
 my $call = XMLRPC::Lite->proxy("http://example.org/yourblog")->call(
     "wp.deleteComment", # method
     1, # blog ID, usually just set to 1
     "username",
     "password",
     13,
 );
 my $fault = $call->fault;
 if ($fault && $fault->{faultCode}) {
     die "Can't delete comment: $fault->{faultCode} - $fault->{faultString}";
 }

To find the list of available methods and arguments, see the WordPress API reference (see "SEE ALSO").

FUNCTIONS

wp_deleteComment

Usage:

 wp_deleteComment(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • comment_id* => posint

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_deletePost

Usage:

 wp_deletePost(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • password* => str

  • post_id* => posint

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_deleteTerm

Usage:

 wp_deleteTerm(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • password* => str

  • proxy* => str

  • term_id* => posint

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_editComment

Usage:

 wp_editComment(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • comment* => str

  • comment_id* => posint

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_editPost

Usage:

 wp_editPost(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • content* => str

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_editProfile

Usage:

 wp_editProfile(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • content* => str

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_editTerm

Usage:

 wp_editTerm(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • content* => str

  • password* => str

  • proxy* => str

  • term_id* => posint

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getAuthors

Usage:

 wp_getAuthors(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getComment

Usage:

 wp_getComment(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • comment_id* => posint

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getCommentCount

Usage:

 wp_getCommentCount(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • password* => str

  • post_id* => posint

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getCommentStatusList

Usage:

 wp_getCommentStatusList(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getComments

Usage:

 wp_getComments(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • filter => str

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getMediaItem

Usage:

 wp_getMediaItem(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • attachment_id* => posint

  • blog_id => posint (default: 1)

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getMediaLibrary

Usage:

 wp_getMediaLibrary(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • filter => str

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getOptions

Usage:

 wp_getOptions(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • options => str

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getPost

Usage:

 wp_getPost(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • fields => str

  • password* => str

  • post_id* => posint

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getPostFormats

Usage:

 wp_getPostFormats(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • filter => str

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getPostStatusList

Usage:

 wp_getPostStatusList(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getPostType

Usage:

 wp_getPostType(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • fields => str

  • password* => str

  • post_type_name* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getPostTypes

Usage:

 wp_getPostTypes(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • fields => str

  • filter => str

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getPosts

Usage:

 wp_getPosts(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • filter => str

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getProfile

Usage:

 wp_getProfile(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • fields => str

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getTaxonomies

Usage:

 wp_getTaxonomies(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getTaxonomy

Usage:

 wp_getTaxonomy(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • password* => str

  • proxy* => str

  • taxonomy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getTerm

Usage:

 wp_getTerm(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • password* => str

  • proxy* => str

  • taxonomy* => str

  • term_id* => posint

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getTerms

Usage:

 wp_getTerms(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • password* => str

  • proxy* => str

  • taxonomy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getUser

Usage:

 wp_getUser(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • fields => str

  • password* => str

  • proxy* => str

  • user_id* => posint

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getUsers

Usage:

 wp_getUsers(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • fields => str

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_getUsersBlogs

Usage:

 wp_getUsersBlogs(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • isAdmin* => bool

  • password* => str

  • proxy* => str

  • username* => str

  • xmlrpc* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_newComment

Usage:

 wp_newComment(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • comment* => str

  • password* => str

  • post_id* => posint

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_newPost

Usage:

 wp_newPost(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • content* => str

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_newTerm

Usage:

 wp_newTerm(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • content* => str

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

wp_setOptions

Usage:

 wp_setOptions(%args) -> [status, msg, result, meta]

This function is not exported.

Arguments ('*' denotes required arguments):

  • blog_id => posint (default: 1)

  • options* => str

  • password* => str

  • proxy* => str

  • username* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-wp-xmlrpc.

SOURCE

Source repository is at https://github.com/perlancar/perl-App-wp-xmlrpc.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-wp-xmlrpc

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

API reference: https://codex.wordpress.org/XML-RPC_WordPress_API

Other WordPress API modules on CPAN: WordPress::XMLRPC by Leo Charre (a thin wrapper over XMLRPC::Lite), WordPress::API by Leo Charre (an OO wrapper over WordPress::XMLRPC, but at time of this writing the module has not been updated since 2008/WordPress 2.7 era), WP::API by Dave Rolsky (OO interface, incomplete).

Other WordPress API CLI on CPAN: wordpress-info, wordpress-upload-media, wordpress-upload-post (from WordPress::CLI distribution, also by Leo Charre).

XMLRPC::Lite

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017, 2016 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.