0

I probably have a plugin that makes a request to an URL slowly down my website. At the moment I'm still debugging the issue but, in the meantime, is there a way to prevent Wordpress to request this URL?

I know there's the rule define('WP_HTTP_BLOCK_EXTERNAL', true); but it actually blocks every request.

  • "probably have a plugin"? Use chrome's Network tab to find out what is going on. If a plugin is noticeably slowing down your site it should be removed. – RiddleMeThis Apr 23 at 19:48
  • you can't check which plugin is requesting that url with network tab – NicoCaldo Apr 23 at 20:34
  • No it won't tell you the plugin but I would think it should give you some hints – RiddleMeThis Apr 23 at 20:38
  • The fact this URL request an external POST to its domain and, in the meantime, I figured out the problem, I need to block the requests to this URL – NicoCaldo Apr 24 at 8:43
0

Like you suggested, use WP_HTTP_BLOCK_EXTERNAL to stop all external URL requests. And then use WP_ACCESSIBLE_HOSTS to set allowed URLs.

From the WP Codex, found on this page.

wp-config.php

define( 'WP_HTTP_BLOCK_EXTERNAL', true );
define( 'WP_ACCESSIBLE_HOSTS', 'api.wordpress.org,*.github.com' );

Block external URL requests by defining WP_HTTP_BLOCK_EXTERNAL as true and this will only allow localhost and your blog to make requests. The constant WP_ACCESSIBLE_HOSTS will allow additional hosts to go through for requests. The format of the WP_ACCESSIBLE_HOSTS constant is a comma separated list of hostnames to allow, wildcard domains are supported, eg *.wordpress.org will allow for all subdomains of wordpress.org to be contacted.

Note: This could have unintended consequences like potentially breaking plugins, auto updates, etc.

  • yes but I have to block only one. All the other hosts are allowed. I'm also using Google AdSense so, blocking every request isn't practical for me because of AdSense that loads very different URLs every time – NicoCaldo Apr 23 at 19:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.