Warning: DOMDocument::loadHTML(): Tag template invalid in Entity, line: 17 in /var/www/content/plugins/gistpress/includes/class-gistpress.php on line 466
Warning: DOMDocument::loadHTML(): Tag svg invalid in Entity, line: 19 in /var/www/content/plugins/gistpress/includes/class-gistpress.php on line 466
Warning: DOMDocument::loadHTML(): Tag path invalid in Entity, line: 20 in /var/www/content/plugins/gistpress/includes/class-gistpress.php on line 466
Warning: DOMDocument::loadHTML(): Tag template invalid in Entity, line: 32 in /var/www/content/plugins/gistpress/includes/class-gistpress.php on line 466
Warning: DOMDocument::loadHTML(): Tag svg invalid in Entity, line: 34 in /var/www/content/plugins/gistpress/includes/class-gistpress.php on line 466
Warning: DOMDocument::loadHTML(): Tag path invalid in Entity, line: 35 in /var/www/content/plugins/gistpress/includes/class-gistpress.php on line 466
Attachments
Last modified by - 11 years ago
3807 Views
Less than a minute read
How to get error message when using wp_remote_post and wp_remote_get
When using WordPress HTTP API, if the connection fails you could use the below code to display the error message.
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
Both wp_remote_post and wp_remote_get return WP_Error object if there is an error. You could use the get_error_message function of WP_Error class to receive the error and show it.