“CRITICAL Object of class WP_Error could not be converted to string” using templates with twig

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 ) ) { … Read more

Object of class WP_Query could not be converted to int inside shortcode

I rewrote the function based on a few other posts I have seen online and now have the following code which works without any errors. I am still open to any further suggestions on the best way to streamline this code even further it it can be. Thanks again function downloads_shortcode($atts){ extract(shortcode_atts(array( ‘download_type’ => ” … Read more

Title tag wont change

see there are any upgrade available for the theme.. if not add add_theme_support( ‘title-tag’ ); in your functions.php

How do I create a state of “don’t assign anything to variable” if WP_Error throws an error?

Looks like the line giving you the error is rather this one $data = json_decode( $this->get_json(), true); Like this (untested) it should work: private function get_data() { /** * Ingests the data from get_json() then converts / decodes into an array. */ $json = $this->get_json(); if (is_wp_error($json)) { return new WP_Error( ‘invalid-data’, esc_html__( ‘Something is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)