'Cache-Control' => 'no-cache',
'X-WP-Nonce' =>
wp_create_nonce( 'wp_rest'
),
);
/** This filter is documented in wp-includes/class-wp-http-streams.php */
$sslverify =
apply_filters( 'https_local_ssl_verify', false
);
// Include Basic auth in loopback requests.
if ( isset( $_SERVER['PHP_AUTH_USER'
] ) &&
isset( $_SERVER['PHP_AUTH_PW'
] ) ) { $headers['Authorization'
] = 'Basic ' .
base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'
] ) . ':' .
wp_unslash( $_SERVER['PHP_AUTH_PW'
] ) );
} $url =
rest_url( 'wp/v2/types/post'
);
// The context for this is editing with the new block editor.
$url =
add_query_arg( array
( 'context' => 'edit',
),
$url );
$r =
wp_remote_get( $url,
compact( 'cookies', 'headers', 'timeout', 'sslverify'
) );