• Resolved cecowe

    (@cecowe)


    Hey there,
    I’ve been using this in functions.php to show seo title in the frontend.

    <?php
    add_shortcode( 'product_seo_title', 'my_product_seo_title' );
    function my_product_seo_title( $atts = array() ) {
        $title = $GLOBALS['wpseo_og']->og_title( false );
        return $title;
    }

    But after updating to 14.0 it breaks the site:

    Fatal error: Uncaught Error: Call to a member function og_title() on null in /home/vitakphw/public_html/wp-content/themes/flatsome-child/functions.php:4 Stack trace: #0 /home/vitakphw/public_html/wp-includes/shortcodes.php(343): my_product_seo_title('', '', 'product_seo_tit...') #1 [internal function]: do_shortcode_tag(Array) #2 /home/vitakphw/public_html/wp-includes/shortcodes.php(218): preg_replace_callback('/\\[(\\[?)(produc...', 'do_shortcode_ta...', '[product_seo_ti...') #3 /home/vitakphw/public_html/wp-content/themes/flatsome/inc/structure/structure-header.php(128): do_shortcode('[product_seo_ti...') #4 /home/vitakphw/public_html/wp-content/themes/flatsome/inc/structure/structure-header.php(87): flatsome_get_header_html_element('html') #5 /home/vitakphw/public_html/wp-content/themes/flatsome/template-parts/header/header-top.php(6): flatsome_header_elements('topbar_elements...') #6 /home/vitakphw/public_html/wp-includes/template.php(725): require('/home/vitakphw/...') #7 /home/vitakphw/public_html/wp-includes/templat in/home/vitakphw/public_html/wp-content/themes/flatsome-child/functions.php on line 4

    What should I replace to make it work again?

    Thank’s fellas.

Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Seo title’ is closed to new replies.