• Resolved jeffylube

    (@jeffylube)


    Hello

    Trying to update the WooCommerce Product Schema description to output product description (‘post_content’). By default, it pulls the short description (‘post_excerpt’).

    Added the following code, but doesn’t seem to work. Am I doing something wrong?

    add_filter( "slim_seo_schema_{$context}", function ( $schema ) {
    
        // Add or modify a property.
        $schema['description'] = 'post_content';
    
        return $schema;
    } );
Viewing 2 replies - 1 through 2 (of 2 total)
  • Not the dev but I believe this works. There are 2 filters for the meta description in the docs linked here, https://wpslimseo.com/docs/hooks/

    slim_seo_meta_description_generated and slim_seo_meta_description. These will change the meta content and the og:description content

    slim_seo_meta_description will modify the output directly without changing the metabox content.

    slim_seo_meta_description_generated changes the generated content (Meta description generate as you type)

    
    add_filter( 'slim_seo_meta_description_generated', function ( $description ){
            $description = get_post_field('post_content', $post_id);
        return $description;
    } );
    

    Also you might want to add in a conditional if is_product() since you are only targeting Woocommerce Products

    Plugin Author Anh Tran

    (@rilwis)

    Hi @jeffylube,

    The product schema is provided by WooCommerce, not by Slim SEO. Slim SEO only provides the schema for articles, webpage and so on. To change the schema from WooCommerce, please refer to WooCommerce’s documentation.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Unable to Modify Schema Property’ is closed to new replies.