xmlrpc.php Returning 405 Response Code

You can look at the requests data / response data via Developer Tools in your browser (usually F12, but depends on your browser). That might give you some indication of the direction to investigate. Personal Opinion Personally, I have disabled xmlrpc.prg on all of my sites. It is an easy way for a hacker to … Read more

wp.getUsers XML-RPC method is returning only 50 users, how can i get all the users

I’m unable to find a XML-RPC method called wp.getUsers in wp-includes/class-wp-xmlrpc-server.php. Could it be, that you’re using an additional plugin that extends the basic behavior of WordPress? A simple google search for ‘wp.getUsers’ points me to the the github repo of Max Cutler and the class wp-xmlrpc-modernization. There you have a method wp.getUsers which accepts … Read more

get total number of images from media using xml-rpc

VERSION 1 will query all the images and give you a count by checking the size of the returned array. VERSION 2 is a much faster method introduced by birgire. // VERSION 1 $images = get_posts(array( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘any’, ‘numberposts’ => -1, ‘fields’ => ‘ids’, ‘post_mime_type’ => ‘image/jpeg,image/gif,image/jpg,image/png’, )); echo count($images) . … Read more

XMLRPC Avoid duplicate content

Since you add a reference to my previous answer, let me share how I tested it: Setup on site A – XML-RPC Client include_once( ABSPATH . WPINC . ‘/class-IXR.php’ ); include_once( ABSPATH . WPINC . ‘/class-wp-http-ixr-client.php’ ); $client = new WP_HTTP_IXR_CLIENT( ‘http://example.tld/xmlrpc.php’ ); // <– Change! $client->debug = true; $result = $client->query( ‘wp.newPost’, [ 0, … Read more

How to secure WordPress XMLRPC?

XMLRPC is as secure as the rest of WordPress. All of the requests need to be authenticated with username and password credentials that exist on your site already. That means, if someone has a login for your site, they can use the XMLRPC interface (if it’s turned on). But anonymous users can’t get in. The … Read more

How to get all posts (in chunks) via XML-RPC?

According to topic in official forums [xmlrpc] How to get posts with offset? The existing XML-RPC APIs don’t really provide a way for collecting all of the post data right now. (Joseph Scott) Topic is somewhat old and I am not aware if there were some changes since, but from quick look at source it … Read more

XMLRPC and Underscored custom fields

Playing with XML-RPC and underscored custom fields: Let’s say we want to set the featured image to a given post with $remote_post_id. We want it to be the attachment with ID equal to 300, so we want _thumbnail_id to be 300. Here are three methods how one could achieve that: Method #1 – Using post_thumbnail … Read more

Disable links in header (feeds and such)

On template_redirect the template-loader.php kicks in. add_action( ‘template_redirect’, function() { if ( in_array( true, array ( is_feed(), is_trackback(), is_embed(), ) ) ) { wp_die( __( “NO SOUP FOR YOU!” ) ); } } ); If the do_feed() is called then a few actions can be invoked. add_action( ‘init’, function() { $feeds = array ( ‘do_feed’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)