#55481 closed feature request (invalid)
Add custom headers for `update_plugins_{$hostname}` filter's package
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Upgrade/Install | Keywords: | |
Focuses: | Cc: |
Description
This update_plugins_{$hostname}
filter may aim to update private plugins, but this feature has no authentication logic.
When I add to GitHub's release zipball URL to this filter, I can update only public repository's zipball.
So I think this filter need custom headers to package's URL(e.g. Authorization header).
Thank you.
Change History (4)
Note: See
TracTickets for help on using
tickets.
@natsumesou Thank you for the ticket...and welcome to Trac.
If I understand what you problem is, you can use the http_request_args filter to add the
Authentication
header.You should be able to do something like (note: the following code has not been tested):
add_filter( 'http_request_args', function( $parsed_args, $url ) { if ( MY_UPDATE_URL === $url ) { if ( empty( $parsed_args['headers'] ) ) { $parsed_args['headers'] = array(); } $parsed_args['headers']['AUTHORIZATION'] = MY_AUTH_HEADER_VALUE; } return $parsed_args; }, 10, 2 );
where
MY_UPDATE_URL
andMY_UPDATE_URL
are just placeholders (and not to be interpreted as PHP constants) and should be replaced by whatever your use case requires.