no longer can save schema markup data in Custom Field
-
I’m having a new problem with custom fields as they are officially documented here: Assign custom fields – Documentation – www.ads-software.com
For years I have been adding a custom field called “schemamarkup” into which I paste and save the output generated by the Google Structured Data Markup Helper tool.
I have gone several months without posting on my site. Today for a new post, the block editor will no longer save the output from the Google Structured Data Markup Helper tool in a custom field. I paste it into the value input field and click Add Custom Field or Update and the pasted data vanishes and cannot be saved. If I just put the word “test” in the value input field, that is saved. However, I need to save the schema markup. My WordPress installation is fully up to date along with all plugins.
The output I have from the Google Schema Markup Helper tool is of the form:
<!-- JSON-LD markup generated by Google Structured Data Markup Helper. --> <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Article", "headline": "My WordPress Post Title", "name": "My WordPress Post Title", "author": { "@type": "Person", "name": "Author's Name" }, "datePublished": "2023-11-01", "dateModified": "2023-11-01", "image": "[image URL]", "articleSection": "(WordPress post category)", "url": "[post URL]", "publisher" : { "@type" : "Organization", "name" : "my organization's name", "logo": { "@type": "ImageObject", "name": "site logo name", "width": "600", "height": "60", "url": "[logo URL]" } } } </script>
I have added this type of markup via custom fields successfully for years, starting with the classic editor and then with the block editor once it supported adding custom fields.
Yesterday I edited and saved an existing post with markup data in a custom field and the markup data remained intact. However, I imagine that I’d have trouble if I wanted to edit existing markup data in a custom field and save the updated data.
I’m using a child theme that has this added to header.php to pick up the markup data from the custom field. It’s the last thing included in before the closing tag of the <head> section.
<?php $schemamarkup = get_post_meta(get_the_ID(), 'schemamarkup', true); if(!empty($schemamarkup)) { echo $schemamarkup; } ?>
The above description has been my routine workflow for years. Something has broken it. How can this be fixed?
Thanks.
- The topic ‘no longer can save schema markup data in Custom Field’ is closed to new replies.