• Hi,

    We are using version 6.9.7 of plugin SEO Ultimate, and it seems there is as bug when a post has only one tag :

    We got this error :
    Object of class WP_Error could not be converted to string wp-content/plugins/seo-ultimate/modules/titles/titles.php on line 273

    After debugging and looking at the code (line 246 to 273)

    $variables = array(
                              '{blog}' => get_bloginfo('name')
                            , '{tagline}' => get_bloginfo('description')
                            , '{post}' => $post_title
                            , '{page}' => $post_title
                            , '{page_parent}' => $parent_title
                            , '{category}' => $cat_title
                            , '{categories}' => $cat_titles
                            , '{category_description}' => $cat_desc
                            , '{tag}' => $tag_title
                            , '{tag_description}' => $tag_desc
                            , '{tags}' => su_lang_implode(get_the_tags($post_id), 'name', true)
                            , '{daynum}' => $daynum
                            , '{day}' => $day
                            , '{monthnum}' => $monthnum
                            , '{month}' => $month
                            , '{year}' => $year
                            , '{author}' => $author['name']
                            , '{author_name}' => $author['name']
                            , '{author_username}' => $author['username']
                            , '{author_firstname}' => $author['firstname']
                            , '{author_lastname}' => $author['lastname']
                            , '{author_nickname}' => $author['nickname']
                            , '{query}' => su_esc_attr(get_search_query())
                            , '{ucquery}' => su_esc_attr(ucwords(get_search_query()))
                            , '{url_words}' => $this->get_url_words($_SERVER['REQUEST_URI'])
                    );
                    $title = str_replace(array_keys($variables), array_values($variables), htmlspecialchars($format));

    When a post has only one tag, get_the_tags does not return an array but a tag object. In this case su_lang_implode also returns an object causing str_replace to trigger an error.

    We found a work-around replacing the line :
    , '{tags}' => su_lang_implode(get_the_tags($post_id), 'name', true)
    with
    , '{tags}' => su_lang_implode( (array) get_the_tags($post_id), 'name', true)

    Can you take a look at this issue ?

    Thanks.

    https://www.ads-software.com/extend/plugins/seo-ultimate/

  • The topic ‘[Plugin: SEO Ultimate] bug when post has only one tag’ is closed to new replies.