=== Microdata to JSON-LD Converter === Contributors: sethsm Tags: schema.org, Microdata, json-ld, seo, structured data Requires at least: 5.5 Tested up to: 7.0 Stable tag: 2.0 Requires PHP: 7.2 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Donate link: https://www.paypal.com/donate/?hosted_button_id=M3B2Q94PGVVWL Plugin URI: https://www.sethcreates.com/plugins-for-wordpress/microdata-to-json-ld-converter/ Author URI: https://www.sethcreates.com/plugins-for-wordpress/ A powerful tool to convert your existing Schema.org Microdata into the preferred JSON-LD format, clean up your HTML, and maintain structured data. == Description == Is your WordPress theme or website built with inline Schema.org Microdata? As search engines increasingly prefer the JSON-LD format for structured data, updating your site can be a significant challenge. Manually removing old Microdata and creating new JSON-LD scripts for every page is tedious and error-prone. The **Microdata to JSON-LD Converter** solves this exact problem. This plugin seamlessly automates the entire conversion process: 1. **Scans Your Pages:** It fetches the full HTML of your published posts and pages, ensuring it captures all Microdata, whether it's in your post content or your theme files (like `header.php`). 2. **Converts to JSON-LD:** It intelligently parses the `itemscope`, `itemtype`, and `itemprop` attributes and converts them into a well-structured JSON-LD script. 3. **Removes Inline Microdata:** Optionally, it can clean up your public-facing HTML by removing the now-redundant Microdata attributes, leaving only the clean JSON-LD script in the `
`. 4. **Keeps It Fresh:** With the "Keep up to date" option, the plugin can automatically regenerate the JSON-LD every time you update a post, ensuring your structured data always reflects your latest content. **Key Features:** * **Full Page Parsing:** Accurately reads Microdata from the entire webpage, not just post content. * **Automatic Generation:** Automatically creates the initial JSON-LD when you open a published post for the first time. * **Manual Control:** View and edit the generated JSON-LD directly in a meta box on each post's edit screen. * **Built-in Validator:** Get instant feedback on your schema with a built-in validator that checks for common required and recommended properties. * **Bulk Rebuild Tool:** Process your entire site at once with a batch-processing tool that works through all your posts and pages. * **"Set It and Forget It" Mode:** Enable the "Keep JSON-LD up to date" option to ensure your structured data remains current. * **Clean & Modern UI:** A simple, intuitive settings page with toggle switches and tabs makes configuration a breeze. * **Homepage WebSite Schema:** Automatically generates WebSite JSON-LD for your homepage, complete with a Sitelinks Search Box to improve your site's search presence. * **Dynamic Archive Schema:** Automatically constructs lightweight CollectionPage and ItemList JSON-LD schema for Category and Tag pages, matching Google's exact specifications for list data without slowing down your server. * **Knowledge Graph Auto-Linking:** Automatically identifies standalone entities (like Local Businesses) and links them to your main Article schema using dynamic `@id` references for a unified data graph. This plugin offers a seamless migration path to modernize your site's SEO and structured data implementation, eliminating the need to edit your content, plugins, or theme files. == Installation == 1. Upload the `microdata-to-json-ld-converter` folder to the `/wp-content/plugins/` directory. 2. Activate the plugin through the 'Plugins' menu in WordPress. 3. Navigate to `Settings > Microdata to JSON-LD` to configure the plugin. 4. Enable the desired options, such as "Enable JSON-LD Output" and "Remove Inline Microdata from HTML". 5. Optionally, use the "Bulk Rebuild Tools" tab to process all your existing content. == Frequently Asked Questions == = How do I generate the JSON-LD for my posts? = You have two main options: 1. **Automatically:** For a single post, simply open the post editor. If the post is published and no JSON-LD exists, the plugin will automatically generate it. For all posts, use the "Bulk Rebuild Tools" on the plugin's settings page. 2. **Manually:** In the post editor, you can click the "Regenerate" button inside the "Schema.org JSON-LD" meta box at any time. = What does the "Keep JSON-LD up to date" option do? = When this option is enabled, the plugin will automatically regenerate the JSON-LD every single time you click "Update" on a post. This ensures your structured data always matches your content, but it will overwrite any manual changes you've made in the JSON-LD text box. If you plan to manually edit your JSON-LD, you should leave this option turned off. = Will this remove Microdata from my theme files? = The "Remove Inline Microdata from HTML" option removes the Microdata attributes from the final HTML that is sent to the user's browser. It does **not** edit or delete your actual PHP theme files. The original Microdata will still be in your files, but it will be invisible on the front end. = Does the 'Remove Inline Microdata' feature work with caching? = The "Remove Inline Microdata from HTML" option works by capturing the entire page output after it has been generated and before it is sent to the browser. This method, while effective, may prevent some server-side caching systems (like Varnish or NGINX FastCGI Cache) from serving cached pages. This is because the output buffer signals that the content is being dynamically modified. If you are on a managed WordPress host that utilizes this type of caching, you should test this feature to ensure there are no conflicts. Alternatively, you can keep it disabled if you notice issues with your site's cache. = Can I check if my generated JSON-LD is valid? = Yes. In the "Schema.org JSON-LD" meta box, you have two options. The "Validate" button runs a check against a built-in list of best practices for common schema types. For a complete, official analysis, use the "Test on Google" button to open the page in Google's Rich Results Test. = How do I disable the automatically generated WebSite schema on my homepage? = The plugin automatically detects major SEO plugins (like Yoast, AIOSEO, and Rank Math) and safely disables its own WebSite schema to prevent duplicates. However, if you are manually injecting your own custom script and need to disable the plugin's output, you can do so by adding this single line to your theme's functions.php file: ` add_filter( 'mdtj_output_website_schema', '__return_false' ); ` = How is this plugin connected to the Microdata Refinement Department at LUMON? = This plugin bears no relation whatsoever to LUMON or the MDR Department on the Severed Floor. The "Microdata" processed by this plugin is a structured data markup outlined by schema.org, which has fallen out of favor and has largely been replaced by the JSON-LD format (hence, why this converter exists). = What is the recommended implementation of this plugin? = Use the Microdata to JSON-LD Converter in 5 easy steps. 1) Open the post editor, scroll down to the box titled "Schema.org JSON-LD." Verify that the created JSON-LD matches your existing schema.org content. 2) After you have reviewed the "Schema.org JSON-LD" meta boxes on multiple posts and pages, use the Bulk Rebuild Tools to create JSON-LD meta for each post and page on your website. This build process will take several minutes for larger sites. 3) Within the General Settings of the Microdata to JSON-LD Settings, toggle on "Enable JSON-LD Output." Doing this will add the JSON-LD to the head element of your webpages. The content within the "Schema.org JSON-LD" meta boxes is now being added to your published posts and pages. 4) Within the General Settings of the Microdata to JSON-LD Settings, toggle on "Remove Inline Microdata from HTML." Doing this will strip the Microdata from the HTML output of your webpages. Although this plugin removes the inline Microdata attributes from the final public-facing HTML, it will not affect your backend theme files, plugins, and content where the Microdata markups originate. Note: To ensure that the inline Microdata does not serve as a duplicate of the new JSON-LD, both "Enable JSON-LD Output" and "Remove Inline Microdata from HTML" should be enabled in unison. 5) To keep your JSON-LD updated going forward, toggle the option "keep JSON-LD up to date." This will ensure that your post's JSON-LD information is updated when you make changes to your posts and pages. If you have, or plan to, make manual edits within the JSON-LD meta boxes, keep this option turned off. However, in most cases, it will be helpful to automate keeping the JSON-LD up to date. == Screenshots == 1. The clean, tabbed settings page for Microdata to JSON-LD Converter showing the modern toggle switches for the main options. 2. The "Bulk Rebuild Tools" tab, showing the post type selection and progress bar. 3. The meta box in the post editor, showing the generated JSON-LD. 4. The meta box's validation results after clicking the "Validate" button. == Changelog == = 2.0 = * **IMPROVEMENT:** Added JSON-LD support for drafts to populate the JSON-LD meta box before posts go live. * **DEV:** Tested Up To WordPress 7.0. = 1.9 = * **NEW:** Intelligent Knowledge Graph Auto-Linking. The plugin now automatically identifies standalone entities on the page (like Local Businesses and Campgrounds) and seamlessly links them to the main Article using the schema 'about' property and unique dynamically generated '@id' attributes. * **NEW:** Added a settings toggle in the dashboard to enable or disable the "Auto-Link Schema Entities" feature, providing granular control over Knowledge Graph construction. * **FIX:** Resolves an issue where floating-point numbers could render with excessively long decimal tails in the JSON-LD output. = 1.8.3 = * **IMPROVEMENT:** Enhanced type-casting for Schema properties. Numbers and booleans (e.g., true/false) extracted from Microdata are now output as native JSON data types rather than strings, ensuring strict compliance with Schema.org standards and with rich results testing tools. = 1.8.2 = * **FIX:** Improved cleanup of malformed (and unmatched) `` and `