Title: Schema code doesn&#8217;t save &#8211; help?
Last modified: December 19, 2024

---

# Schema code doesn’t save – help?

 *  Resolved [Gemini23](https://wordpress.org/support/users/gemini23/)
 * (@gemini23)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/schema-code-doesnt-save-help/)
 * Can anyone advise? When I enter a schema code (and the code is validated), when
   I save the WooCommerce category and the URL refreshes, the code disappears (i.
   e., it is not saved). What am I doing wrong?

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

 *  [pauserratgutierrez](https://wordpress.org/support/users/pauserratgutierrez/)
 * (@pauserratgutierrez)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/schema-code-doesnt-save-help/#post-18210560)
 * Hi [@gemini23](https://wordpress.org/support/users/gemini23/)
 * Could you please provide a little bit more context on this issue? This extra 
   data will help us determine the best way to help you with our Code Snippets plugin.
    - What exact code are you adding.
    - Describe the process you follow to add this code. Which snippet type are you
      using for the schema? Are you doing any specific configuration to the snippet?
    - Does this happen to this specific snippet you are adding? So, can you add 
      other snippets and they work as expected?
 *  Thread Starter [Gemini23](https://wordpress.org/support/users/gemini23/)
 * (@gemini23)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/schema-code-doesnt-save-help/#post-18210579)
 * Hi –
 * I have realised that the code box is an existing one (not a Snippets one) and
   one that does work on another website
 * The code that I have used to try to add a new Snippets Custom Code Box doesn’t
   create a new Custom Code box to display…
   **Please can you advise the code that
   would work? It is to add schema** for Woocommerce Categories
 * Custom Code Box for WooCommerce Categories – Many Thanks
 *     ```wp-block-code
       // Add custom field to WooCommerce category edit screenadd_action('product_cat_add_form_fields', 'add_custom_schema_field');add_action('product_cat_edit_form_fields', 'edit_custom_schema_field');// Display custom field on create screenfunction add_custom_schema_field() {?>Custom Schema CodeEnter custom schema or code for this category.<?php}// Display custom field on edit screenfunction edit_custom_schema_field($term) {$value = get_term_meta($term->term_id, 'custom_schema_code', true);?>Custom Schema Code <?php echo esc_textarea($value); ?>Enter custom schema or code for this category.<?php}// Save the custom fieldadd_action('created_product_cat', 'save_custom_schema_field');add_action('edited_product_cat', 'save_custom_schema_field');function save_custom_schema_field($term_id) {if (isset($_POST['custom_schema_code'])) {update_term_meta($term_id, 'custom_schema_code', sanitize_textarea_field($_POST['custom_schema_code']));}}
       ```
   
    -  This reply was modified 1 year, 5 months ago by [Gemini23](https://wordpress.org/support/users/gemini23/).
 *  [pauserratgutierrez](https://wordpress.org/support/users/pauserratgutierrez/)
 * (@pauserratgutierrez)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/schema-code-doesnt-save-help/#post-18235896)
 * Hi [@gemini23](https://wordpress.org/support/users/gemini23/)
 * We offer our support for issues related to Code Snippets itself, but I cannot
   provide specific code for you as I’m not an expert on that. I can suggest you
   to hire a developer. You can also try an AI ChatBot such as chatgpt, if you wish.
 * Thanks for understanding.
 * Best regards,
   Pau.

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

The topic ‘Schema code doesn’t save – help?’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [pauserratgutierrez](https://wordpress.org/support/users/pauserratgutierrez/)
 * Last activity: [1 year, 4 months ago](https://wordpress.org/support/topic/schema-code-doesnt-save-help/#post-18235896)
 * Status: resolved