This is probably the issue:
$currency = wp_remote_get($current_ping);
if($currency){
$currency
will either be a WP_Error
object or an array
. Checking if($currency)
will be true in both cases.
Instead, you should check if it’s an array and not an error object:
if ( is_array( $currency ) && ! is_wp_error( $currency ) ) {
of course, that won’t fix the fact that wp_remote_get
returns an error…
Related Posts:
- Conditionally Loading JavaScript/CSS for Shortcodes
- Show shortcode without executing it
- How to create a shortcode with 1 parameter (atts)
- How does a shortcode work?
- Run visual composer code in php page
- Remove wptexturize from a shortcode?
- Using shortcode in Post title
- Audio or playlist shortcode condition according to the amount of files on attachment page
- Does a shortcode with a single attribute have to use an array?
- WP_enqueue_script inside shortcode?
- template_redirect to accompany with a shortcode
- Tinymce shortcodes within shortcode contents
- Pass shortcode variables to template
- passing multiple parents value into a shortcode
- Is it possible to add a repeater field to TinyMCE’s option window?
- How do I preview the result of a shortcode in the TinyMCE editor?
- esc_attr not working in shortcode
- Raw output (preventing wpautop)
- Conditionally loading Facebook PHP SDK in shortcode
- WordPress shortcode doesn’t working on HomePage
- How to handle shortcodes when using the JSON API
- Are shortcode functions applied while rendering the content, or are they executed and stored with the post content?
- is_admin() returns false in save_post hook with Gutenberg editor
- Why are Shortcodes Disabled in Widgets by Default?
- Add attribute to shortcode dynamically
- Execute shortcode twice in the same page
- possibility to control embedded video timeline with buttons and links external to the player
- Add custom setting that uses radio button to WP Gallery
- Shortcode with hyphen doesn’t work
- Shortcode parsed incorrectly because of heredoc
- WordPress Gallery shortcode: Display one category ID only
- How to get gallery id inserted to a post?
- WordPress Shortcode show database row
- Shortcode “post_per_page” not working
- Shortcode is running in page editor
- Custom shortcode is not working in text widget
- Shortcodes won’t work on live environment
- Create a short code to display a specific loop
- Adding to the_content or a variable from within a shortcode function
- Shortcode: text content ends up outside html tags
- How to wp_redirect on ‘init’ hook on condition of current post id?
- Buddypress shortcode for tabs [closed]
- Image Shortcode from ACF ID
- PHP Running On CMS Side of WordPress
- Basic do shortcodes question
- What is this format called (nested shortcodes)?
- Problem with height in video shortcode
- do_shortcode doesn’t work on some pages
- Best tools for preparing and styling a table [closed]
- When are Shortcode Attributes Available in Template
- Regenerating WordPress shortcodes based on value with AJAX
- Form shortcode with multiple options as attributes
- How to add data attributes to the wordpress audio shortcode
- How can I insert a shortcode in the title tag of another?
- Shortcode inside text widget do not call enqueue style
- How to create a dropdown of shortcodes in edit mode for posts
- Metabox Keeps Stripping Parts of Shortcode
- Multiple instances of the shortcode on the same page
- How to Retrieve data of Gallery Shortcode and display it above a post
- Checking post content for a shortcode, but content is being returned as empty
- do_shortcode() won’t return PHP Array
- Excerpt Length & List Category Posts Plugin
- Iteratively add sub shortcodes to php array
- Show shortcode only in posts
- How to execute a shortcode?
- get_queried_object_id / short code returning blank
- Shortcode won’t take into account custom post ID put in parameter
- How to remove double quotes in a shortcode?
- Shortcode to appear and show the date not code in Title and description of my website
- Shortcode not working inside div html
- shortcode to display specific recent posts
- How to test If a post has a particular term
- wp_link_pages shortcode for ‘nextpagelink’
- Multiple values for one variable
- How can I disable(remove) wpautop (wptexturize, convert_chars) for specific shortcodes only?
- Function in a wordpress shortcode
- shortcode is not rendered
- Impossible to display modification in shortcode code?
- Contact form code not working. Need help!
- Use Shortcode on Custom Page
- WordPress Database Error using $wpdb->get_results()
- Push Shortcode parameter to template
- latest posts shortcode with image
- WordPress plugin shortcodes not outputting anything
- WordPress Gallery with ID’s Shortcode not Working
- Featured image with link to post shortcode, image displaying above the post
- Video shortcode inside tabs shorcode NOT working
- How to stop unwanted splits in excerpts when using shortcodes for sliders or players
- How to add meta slider lite or other slider to main page header in pinboard theme
- shortcode change variable base on user
- Inserting shortcode is blanking excerpt – any ideas?
- Escaping a shortcode so it displays as-is [duplicate]
- WordPress do_shortcode first iteration
- If do_shortcode is blank, return some message
- Add a short code to a plugin
- Previous/Next with the same category
- I’ve broken the short code for Contact Form 7!
- echo a shortcode in a shortcode code?
- Applying if (get_post_meta) to new shortcode
- 3 shortcodes 2 won’t render [closed]