wp_get_post_terms()
returns a WP_Error
on failure. (Are you sure it’s $colection
and not $collection
in that function call?)
You can check the return value using is_wp_error()
and decide what you’re going to output if it is, in fact, a WP_Error
.
For example:
$term = wp_get_post_terms( $colection->posts[0]->ID ,'look' );
if ( is_wp_error( $term ) ) {
echo 'Error: ' . $term->get_error_message();
} else {
echo '<span property="itemListElement" typeof="ListItem">
<a property="item" typeof="WebPage" title="Go to ' .
$term[0]->name . '"href="' .
get_term_link( $term[0]->term_id).'" class="home">
<span property="name">'.$term[0]->name.'</span>
</a>
<meta property="position" content="3"></span> > ';
// Lines broken up for readability
}
Related Posts:
- How to customize the critical error message?
- Fatal error in wordpress htdocs
- How to fix empty dashboard issue in WordPress?
- Fatal error: Call to undefined function wp() in ../wp-blog-header.php?
- Call to undefined function nocache_headers() [closed]
- The famous WordPress white screen of death
- How do I “fix” a wp-blog-header.php error message?
- Blank/White Screen on Frontend but Accessible backend?
- PHP Fatal error: Cannot call overloaded function for non-object in wp-includes/capabilities.php [closed]
- current_user_can on WordPress 3.1.1
- WordPress White Page with Certain Database
- Memory issues – Fatal error: out of memory – plugins?
- PHP Fatal error: Call to undefined function WP_Filesystem() [closed]
- What does this mean: Object of class WP_Error could not be converted to string
- 500 Error only one one page in the WP admin
- How to make my plugin code die gracefully
- Fatal error…Please help me
- Fatal error after updating to WordPress 5
- Revslider error. Impossible to enter admin dashboard [closed]
- Fatal error after update [closed]
- White screen of death after an auto update of WordPress
- Fatal Error after migrating WordPress site from one host to another
- WordPress problem with fatal error
- After Plugin deinstallation, Login impossible and line50 error
- Need help decrypting error and warning messages
- WordPress crashed during update
- Fatal error: Cannot redeclare get_header_image() (previously declared in [closed]
- locked out of wordpress site ‘warning: require once’
- Can’t access my site due to fatal error [closed]
- White screen after a couple hours?
- My site is not working because of this: Fatal error: Cannot redeclare be_themes_contact_authentication [closed]
- Fatal error: Uncaught Error: Call to undefined function do_action_ref_array() when using wp_signon function
- Allowed memory size exhausted
- Fatal error: Call to undefined function the_archive_title ()
- Fatal error: Call to undefined function reset_mbstring_encoding
- WP_Error with get_category_parents
- Fatal Error Class ‘WP_Widget_Pages’ not found in /home/****/public_html/wp-includes/class-wp-widget-factory.php
- Critical error – can’t post comments
- failed to open stream – wp-includes/blocks/file.php
- WordPress critical error (tried plugin + debug!)
- Not able to access admin console after Installing and activating a plugin
- Fatal error: Uncaught Error: Class ‘WP_REST_Meta_Fields’ not found in
- WP_Fatal_Error_Handler OR WP_Error OR try/catch
- Uncaught Stripe\Exception\SignatureVerificationException: Unable to extract timestamp and signatures from header
- unable to edit any page of my wordpress website
- How to remove theme that caused WordPress to crash?
- Fatal error: Uncaught Error: Call to undefined function twentynineteen_post_thumbnail()
- Php Fatal error. Blank wordpress admin panel
- Recoverable fatal error: Object of class WP_Error could not be converted to string in /home/xyz/mysite.com/wp-includes/formatting.php on line 3796
- How to fix wordpress white screen of death a cause bad php code?
- Catchable fatal error: Object of class WP_Error could not be converted to string in
- WordPress site suddenly stopped working
- wp search-replace inside site’s directory bring PHP fatal error
- WordPress Fatal Error
- Blank page and 301 redirect
- White Screen of Death error
- WordPress displays 500 error on PHP errors
- WSOD on 4.1.1 after migrating from Bluehost to Dreamhost
- Object of class WP_Post could not be converted to string
- Fatal error: Call to undefined function term_exists()
- Call to undefined function is_blog_installed(), after creating functions.php [closed]
- Parse error: syntax error, unexpected T_FUNCTION on plugins page
- Blank screen at login/logout – tried everything!
- Fatal error: Can’t use method return value in write context
- Fatal error: Call to undefined function request_filesystem_credentials()
- Fatal error: Allowed memory size of 94371840 bytes exhausted (tried to allocate 42240 bytes) in /home/dh_w7t9sk/morleywines.com/wp-content/plugins/
- HELP! Fatal Error? I can’t access the Dashboard. How do I regain access? [closed]
- Flamingo’s Fatal error: Allowed memory size of 134217728 … wp-includes/wp-db.php on line 2516 [closed]
- WP Elementor Pro causing crtical failure on website
- Fatal error: Uncaught Error: Call to undefined function wpcf7
- How to fix Fatal Error in wp-includes/meta.php after upgrade to PHP 8
- Call to undefined function create_function()
- Fatal error: Uncaught Error: Call to undefined method Elementor\Utils::is_ajax() [closed]
- WordPress core files – PHP Warning: file_exists(): open_basedir restriction in effect
- PHP Fatal error: Using $this when not in object context
- Activate a plugin through PHPMyAdmin or FTP?
- White screen error for a custom theme
- Allowed memory size exhausted. WordPress side solution
- Object of class WP_Error could not be converted to string
- Elementor\Scheme_Typography’ not found [closed]
- White screen of death in Dashboard after clean installation
- White screen of death for wp-admin and error for wp-login.php after entering credentials
- Get errors from WP_Error to different variables
- Fatal error: Allowed memory size of 146800640 bytes exhausted (tried to allocate 57 bytes) in public_html/wp-includes/rewrite.php on line 1561
- WP_Http response throws “Cannot use object of type WP_Error as array”
- PHP Fatal Error – $wpdb a non-object?
- There has been a critical error on your website – won’t fix no matter what
- White blank page when Updating/Draft/Publishing Page/Post
- Featured Image not shown and getting error “Object of class WP_Error could not be converted to int”
- How To Pass Array To get_the_category_by_ID() and Get An Array Back?
- WordPress video js error this.mediaElement.play is not a function
- “edit page” not loading
- Why does this show up when i try to log in
- Error handling for wpdb error – displaying an error message to the user
- Call to a member function get_error_messages() on null [closed]
- Plugin Breaking WordPress Login
- WP_Error message
- Directing to functions.php the correct way
- FATAL ERROR: WP complains about redeclaration [closed]
- kali php problem [closed]