Schema filter | WordPress.org

[ad_1]

I want to add a custom field to the standard product name title, but preferably via filter instead of custom meta fields box. Of course I checked the faq, but couldn’t really tell if standard values can be changed using this filter:

add_filter('site-reviews/schema/Product', function ($schema) { global $product; $product_id = $product->get_id(); $product_name = $product->get_name(); $product_field = get_field('Inhoud', $product_id); $schema['product'] = [ '@type' => 'Product', 'name' => $product_name . '' . $product_field, ]; return $schema; });

But it’s not working, do I need to fill all the key / values in the array? Can you please confirm if this can be done? Or to use the metabox functions. Thank you as always.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer