Ask your WordPress questions! Pay money and get answers fast! (more info)

Remove xmlrpc?

1. How can I remove the xmlrpc.php link from my https pages and/or force it to be https only on the secure pages ?

<link rel="pingback" href="http://www.example.com/xmlrpc.php" />

2. How can I load jquery securely only on my https pages? I want it to remain http on http pages.

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?ver=3.5.1'></script>

Answers (4)

2013-04-26

Luis Abarca answers:

You can uncheck from Discussion settings "Allow link notifications from other blogs (pingbacks and trackbacks)"

or you can use this code


// in your theme functions.php file add this lines

add_filter('wp_headers', 'remove_pingback');

function remove_pingback( $headers )
{
unset($headers['X-Pingback']);
return $headers;
}


Luis Abarca comments:

To add a file via http or https is better to remove the http: part, that way it will adjust automatically

<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?ver=3.5.1'></script>


julesphoto comments:

Hi, That's not what I asked. I want to have the xmlrpc.php link on all pages but not on the https pages.


Luis Abarca comments:

OK, so maybe this way


dd_filter('wp_headers', 'remove_pingback');

function remove_pingback( $headers )
{
if ( is_ssl() ) {
unset($headers['X-Pingback']);
return $headers;
}
}


Luis Abarca comments:

Sorry, i forgot to remove only on pages post type with https


add_filter('wp_headers', 'remove_pingback');

function remove_pingback( $headers )
{
if ( is_page() && is_ssl() ) {
unset($headers['X-Pingback']);
return $headers;
}
}


julesphoto comments:

Thanks for your suggestions:

I am trying to remove this link:

<link rel="pingback" href="http://www.example.com/xmlrpc.php" />

I have tried your ideas and Daniel's but they made no difference.

So I then tried to just add:

add_filter('xmlrpc_enabled', '__return_false');

and remove the link from all pages..... this did not work either.

So then I tried to uncheck from Discussion settings "Allow link notifications from other blogs (pingbacks and trackbacks)"

this does NOT work either....... please any suggestions it's driving me nuts!!


Luis Abarca comments:

then add this instead


if ( is_page() && is_ssl() ) {
add_filter('xmlrpc_enabled', '__return_false');
}


julesphoto comments:

Thanks Luis for all the suggestions but this didn't work either.

2013-04-26

Giri answers:

2)
<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?ver=3.5.1'></script>

2013-04-26

Daniel Yoen answers:

Put this line on functions.php

add_filter('xmlrpc_enabled', '__return_false');

for jQuery remove http, like this :

<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?ver=3.5.1'></script>

hope this help :-)


julesphoto comments:

Hi, That's not what I asked. I want to have the xmlrpc.php link on all pages but not on the https pages.


Daniel Yoen comments:

You can use Luis Method, or try this(Thanks Luis),

if (is_page() && is_ssl())
{
add_filter('xmlrpc_enabled', '__return_false');
}


hope this help :-)


julesphoto comments:

Thanks for your suggestions:

I am trying to remove this link:

<link rel="pingback" href="http://www.example.com/xmlrpc.php" />

I have tried your ideas and Luis's but they made no difference.

So I then tried to just add:

add_filter('xmlrpc_enabled', '__return_false');

and remove the link from all pages..... this did not work either.

So then I tried to uncheck from Discussion settings "Allow link notifications from other blogs (pingbacks and trackbacks)"

this does NOT work either....... please any suggestions it's driving me nuts!!

2013-04-26

Dbranes answers:

In some themes (like Twenty Twelve) this link is hardcoded in the header.php file.

<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />


If that is not the case, you could try to find all filters that use <strong>wp_head</strong>:

add_action('wp_footer',function(){
global $wp_filter;
printf('<pre>%s</pre>',print_r( $wp_filter['wp_head'],true));
});