Skip to content

Fix | Make plugin VIP compliant by removing usage of wp_remote_get#901

Merged
dkotter merged 2 commits intofeature/azure-language-servicefrom
fix/791-make-plugin-vip-compliant-by-removing-usage-of-wp_remote_get
May 20, 2025
Merged

Fix | Make plugin VIP compliant by removing usage of wp_remote_get#901
dkotter merged 2 commits intofeature/azure-language-servicefrom
fix/791-make-plugin-vip-compliant-by-removing-usage-of-wp_remote_get

Conversation

@sksaju
Copy link
Contributor

@sksaju sksaju commented May 12, 2025

Description of the Change

This update replaces all usages of wp_remote_get with the vip_safe_wp_remote_get function to ensure compatibility with WordPress VIP coding standards and improve overall security and reliability when making HTTP requests.

Closes #791

How to test the Change

  • Checkout this branch.
  • Navigate to any feature or function in the plugin that previously relied on wp_remote_get for making external requests.
  • Verify that requests are now handled via vip_safe_wp_remote_get.
  • Confirm expected data is returned and no errors or regressions occur.
  • If applicable, test with error handling (e.g., simulate timeouts or invalid URLs) to ensure graceful fallback or logging.

Changelog Entry

  • Replaced all usage of wp_remote_get with vip_safe_wp_remote_get for VIP compliance.
  • Ensured all affected requests handle timeouts and response validation correctly.
  • Minor code cleanup related to the refactored HTTP requests.

Checklist:

@sksaju sksaju requested review from a team, dkotter and jeffpaul as code owners May 12, 2025 08:39
@jeffpaul jeffpaul added this to the 3.4.0 milestone May 12, 2025
@jeffpaul jeffpaul linked an issue May 12, 2025 that may be closed by this pull request
1 task
$request_params
);
}
$response = safe_wp_remote_get( $request_url, $request_params );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So previously we were setting a higher timeout value here to give the request longer to succeed. That is now removed and I think we'll want to add that back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkotter we have that value in the helper function here

'timeout' => 20, // phpcs:ignore

@dkotter dkotter merged commit 21a8431 into feature/azure-language-service May 20, 2025
1 check passed
@dkotter dkotter deleted the fix/791-make-plugin-vip-compliant-by-removing-usage-of-wp_remote_get branch May 20, 2025 19:51
@dkotter dkotter restored the fix/791-make-plugin-vip-compliant-by-removing-usage-of-wp_remote_get branch May 20, 2025 19:52
@dkotter
Copy link
Collaborator

dkotter commented May 20, 2025

@sksaju Apologies, merged this in but didn't realize this was raised against feature/azure-language-service and not develop. I'm assuming the reasoning here is that PR added in the safe_wp_remote_get function that we wanted to use here. I'm not sure when/if we'll get that other PR merged in so would be ideal if we can get a PR opened against develop and not based off of feature/azure-language-service so we can get this released

@jeffpaul
Copy link
Member

jeffpaul commented Jun 6, 2025

Would also be nice to consider splitting out the VIPCS from https://github.com/10up/classifai/blob/develop/.github/workflows/phpcs.yml into specific YML for https://github.com/10up/wpcs-action/ that's VIPCS only so we can add that check and a related readme badge to note ClassifAI is passing VIPCS?

@av3nger
Copy link
Contributor

av3nger commented Aug 25, 2025

@jeffpaul, I've created a separate with a single missing fix: #987
Also, the VIP standards action is already implemented on https://github.com/10up/classifai/actions/workflows/vipcs.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make plugin VIP compliant by removing usage of wp_remote_get

4 participants