Skip to content

Commit 59691fb

Browse files
author
emireverest
committed
Plugin and readme
First commit of plugin and readme
1 parent a700dcc commit 59691fb

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
# disable-the-xml-rpc
1+
# Disable the XML-RPC
22
WordPress plugin that disables XML-RPC API which is enabled by default.
3+
4+
http://your-wordpress-site/xmlrpc.php will be disabled after you activate this plugin.
5+
6+
This plugin will disable WordPress XMLRPC functions, and will not alter or rename any core files. You can enable XML-RPC functionality again by simply disabling this plugin.

disable-the-xml-rpc.php

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/*
3+
Plugin Name: Disable The XML-RPC
4+
Plugin URI: https://github.com/emkopic/disable-the-xml-rpc
5+
Description: This plugin disables XML-RPC API in WordPress which is enabled by default.
6+
Version: 1.0
7+
Author: Emir
8+
Author URI: https://github.com/emkopic
9+
License: GPLv2
10+
*/
11+
12+
add_filter( 'wp_xmlrpc_server_class', 'emko_wp_xmlrpc_server_class' );
13+
14+
function emko_wp_xmlrpc_server_class() {
15+
return 'emko_wp_xmlrpc_server';
16+
}
17+
18+
require_once(ABSPATH . WPINC . '/class-IXR.php');
19+
20+
class emko_wp_xmlrpc_server extends IXR_Server {
21+
22+
/**
23+
* Register all of the XMLRPC methods that XMLRPC server understands.
24+
*
25+
* Sets up server and method property. Passes XMLRPC
26+
* methods through the 'xmlrpc_methods' filter to allow plugins to extend
27+
* or replace XMLRPC methods.
28+
*
29+
* @since 1.5.0
30+
*
31+
* @return wp_xmlrpc_server
32+
*/
33+
function __construct() {
34+
$this->methods = array(
35+
// PingBack
36+
'pingback.ping' => 'this:pingback_ping',
37+
'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
38+
39+
'demo.sayMyName' => 'this:sayMyName',
40+
'demo.addWhatsUp' => 'this:addWhatsUp'
41+
);
42+
43+
$this->initialise_blog_option_info();
44+
$this->methods = apply_filters('xmlrpc_methods', $this->methods);
45+
}
46+
47+
function serve_request() {
48+
}
49+
50+
/**
51+
* Set up blog options property.
52+
*
53+
* Passes property through 'xmlrpc_blog_options' filter.
54+
*
55+
* @since 2.6.0
56+
*/
57+
function initialise_blog_option_info() {
58+
global $wp_version;
59+
60+
$this->blog_options = array(
61+
);
62+
}
63+
}
64+
?>

0 commit comments

Comments
 (0)