Viewing 1 replies (of 1 total)
  • Plugin Author Rank Math SEO

    (@rankmath)

    Hello @eeuweb,

    Thank you for contacting the support.

    Here is a complete code to register a new variable for Product’s Long description:

    add_action( 'rank_math/vars/register_extra_replacements', function() {
        rank_math_register_var_replacement(
            'wc_long_desc',
            [
                'name'        => esc_html__( 'Product\'s Long Description.', 'rank-math' ),
                'description' => esc_html__( 'Product\'s long description.', 'rank-math' ),
                'variable'    => 'wc_long_desc',
                'example'     => get_product_long_description(),
            ],
            'get_product_long_description'
        );
    } );
    function get_product_long_description() {
    	$product_id = isset( $_GET['post'] ) ? $_GET['post'] : get_queried_object_id();
        $desc = get_post_meta( $product_id, '_et_pb_old_content', true );
        return $desc;
    }

    After adding this you can use %wc_long_desc% variable in the Meta description field.

    Hope that helps.

Viewing 1 replies (of 1 total)
  • The topic ‘Use Woocommerce long description for meta’ is closed to new replies.