Last active
January 17, 2025 08:19
-
-
Save shrimp2t/acaf48f39bb0bc5e1b27059b1d5c6e2b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?hp | |
| $ip_res = wp_remote_get( | |
| 'https://api.ipify.org?format=json', | |
| array( | |
| 'timeout' => 30, | |
| 'sslverify' => false, | |
| ) | |
| ); | |
| $code = wp_remote_retrieve_response_code( $ip_res ); | |
| if ( $code >= 200 && $code < 300 ) { | |
| $ip_data = json_decode( wp_remote_retrieve_body( $ip_res ), true ); | |
| ?> | |
| <p><?php esc_html_e('Your server IP is:', 'onepres-plus') ?> <strong><?php echo esc_html( $ip_data['ip'] ); ?></strong></p> | |
| <?php | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment