why is $_REQUESt[‘redirect_to’] empty?

The redirect_to variable works fine, even as a GET variable, however wp-login.php also uses wp_safe_redirect() for doing the actual redirection, which means that the URL must be on the same website. You can’t redirect to anywhere in the web, just to the same site as the login is located on. This is to prevent some …

Read more

Several times request to load plugins when sending one request

That might well be, but that’s alright. There might be redirects happening, and those will result in multiple requests. The WordPress-Cron System relies on AJAX-requests, those will also show up in the log. If you load any resources (images, scripts, stylesheets) that do not exist, WordPress will be loaded and handle the 404, resulting in …

Read more

How to get value of custom http header?

I checked amazon.com website for retrive X-Amz-Cf-Id header which I belive is not a standard header and for me it is working fine: function wpse_288865_featch_header() { $response = wp_remote_get(‘https://www.amazon.com/’); $custom_header = wp_remote_retrieve_header($response, ‘X-Amz-Cf-Id’); var_dump($custom_header); exit; } add_action(‘init’, ‘wpse_288865_featch_header’); Sometimes amazon.com is not returning this header so please refresh your WordPress site couple of times. I …

Read more

Enable CORS in wordpress

Headers manipulation should be done before template output starts. In WordPress it is typically done in template_redirect hook, which is right before template load but after core has fully loaded.

Running index.php from command line & load balancer health checks

Since wordpress’s execution logic relies on parameters filled by the php-apache connector (mod_php) running a php command line is not guarantied to produce the same results or any at all, all depending on your local settings. In any case, you should not check if your server is functioning from the server itself as there other …

Read more

using wp_remote_get to retrieve own url on local host

Ad Timeout You should be able to get around the timeout using a filter add_filter( ‘http_request_timeout’, ‘wpse35826_timeout_extd’ ); function wpse35826_timeout_extd( $time ) { // Default timeout is 5 return 10; } Choose the right protocol/scheme About your protocol/scheme problem: If it’s your local install, you can use the conditional. function wpse35826_remote_get( $args ) { $protocol …

Read more