Title: Oxygen Builder PHP Schema
Last modified: April 5, 2021

---

# Oxygen Builder PHP Schema

 *  Resolved [robbybobble](https://wordpress.org/support/users/robbybobble/)
 * (@robbybobble)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/oxygen-builder-php-schema/)
 * Dear Support,
 * we use Oxygen Builder to echo out our Schema Data in JSON. The default version
   is working but the translated version echo out:
 * `<script type="application/ld+json">null</script></div>`
 * The PHP that isn’t working is:
 *     ```
       <?php
        global $woocommerce;
         $product = wc_get_product( get_the_ID() );
   
         if ( $product === false ) {
           return;
         }
   
         	$schemades = strip_tags($product->get_description() ); 
       	$schemaprod = $product->get_name();
   
       ?>
       <script type="application/ld+json">
       {
         "@context" : "http://schema.org",
         "@type" : "Product",
         "name" : "<?php echo addslashes($schemaprod); ?>",
         "description" : "<?php echo addslashes($schemades); ?>"
       }
       </script>
       ```
   
 * I get following PHP warning as well:
    Warning: Invalid argument supplied for 
   foreach() in wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Parser/Check/
   Regex/JsonChecker.php on line 108
 * This PHP code is working:
 *     ```
       <?php
        global $woocommerce;
         $product = wc_get_product( get_the_ID() );
   
         if ( $product === false ) {
           return;
         }
   
       ?>
       <script type="application/ld+json">
       {
         "@context" : "http://schema.org",
         "@type" : "Product",
         "name" : "<?php echo addslashes($schemaprod); ?>"
       }
       </script>
       ```
   
 * I already tried to strip away the special characters but that doesn’t work as
   well. The following HTML/JSON gets echo out in the default language:
 *     ```
       "description" : "Edelstahl trifft Segeltau. Die „OSKAR“ in marineblau rot weiss. Kompromisslos, stabil im maritimen Look. gepaart mit einem verkapselten Edelstahl-Magnetverschluss – entwickelt & konstruiert von Brand®.
   
        	extra starker Halt
        	6mm Ø (Segeltau Durchmesser)
        	handgefertigte & passgenaue Qualität
        	nickelfrei
        	wasserfest & rostfrei
        	beständige & abriebfeste Gravur
        	Kompassgravur im Verschluss
        	komfortabel & anschmiegsam
        	für Damen und Herren
        	zügig geliefert im schicken Geschenkkarton
       ",
       ```
   
 * Thank you very much,
 * Robert

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Edson Galina Fortes](https://wordpress.org/support/users/glx77/)
 * (@glx77)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/oxygen-builder-php-schema/#post-14370245)
 * closed
 *  Plugin Contributor [Edson Galina Fortes](https://wordpress.org/support/users/glx77/)
 * (@glx77)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/oxygen-builder-php-schema/#post-14405810)
 * resolved

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Oxygen Builder PHP Schema’ is closed to new replies.

 * ![](https://ps.w.org/weglot/assets/icon-256x256.gif?rev=3333666)
 * [Translate WordPress with Weglot - Multilingual AI Translation](https://wordpress.org/plugins/weglot/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/weglot/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/weglot/)
 * [Active Topics](https://wordpress.org/support/plugin/weglot/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/weglot/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/weglot/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Edson Galina Fortes](https://wordpress.org/support/users/glx77/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/oxygen-builder-php-schema/#post-14405810)
 * Status: resolved