├── readme.txt └── disable-genesis-schema.php /readme.txt: -------------------------------------------------------------------------------- 1 | === Disable Genesis Schema === 2 | Contributors: billerickson 3 | Tags: schema, structured data, genesiswp, yoast, seo 4 | Requires at least: 3.0 5 | Tested up to: 5.1 6 | Stable tag: 1.0 7 | 8 | If you're using Yoast SEO or another plugin to output schema, use this to disable duplicate schema from Genesis 9 | 10 | == Description == 11 | 12 | The Genesis theme framework includes schema / structured data for improved SEO. But if you're using Yoast SEO or another plugin that also adds schema, you'll have duplicate schema on your site which can lead to search engine confusion. 13 | 14 | This plugin lets you remove the schema data from Genesis. It should only be used if you are using a Genesis theme and another plugin to add schema (like Yoast SEO). 15 | 16 | For more information, see [Using Yoast SEO Structured Data with Genesis](https://www.billerickson.net/yoast-schema-with-genesis/) 17 | 18 | **Customization** 19 | 20 | You can use the `be_remove_schema_elements` filter to change which elements on the page have their schema data removed. 21 | 22 | == Installation == 23 | 24 | 1. Upload `disable-genesis-schema` to the `/wp-content/plugins/` directory. 25 | 1. Activate the plugin through the *Plugins* menu in WordPress. 26 | 27 | 28 | == Changelog == 29 | 30 | **Version 1.0** 31 | 32 | * This is version 0.1. Everything's new! 33 | -------------------------------------------------------------------------------- /disable-genesis-schema.php: -------------------------------------------------------------------------------- 1 | 20 | * @copyright Copyright (c) 2019, Bill Erickson 21 | * @license GPL-2.0+ 22 | */ 23 | 24 | add_action( 'init', 'be_disable_genesis_schema' ); 25 | /** 26 | * Disable Genesis Schema 27 | * @author Bill Erickson 28 | * @see https://www.billerickson.net/yoast-schema-with-genesis/ 29 | */ 30 | function be_disable_genesis_schema() { 31 | 32 | $elements = array( 33 | 'head', 34 | 'body', 35 | 'site-header', 36 | 'site-title', 37 | 'site-description', 38 | 'breadcrumb', 39 | 'breadcrumb-link-wrap', 40 | 'breadcrumb-link-wrap-meta', 41 | 'breadcrumb-link', 42 | 'breadcrumb-link-text-wrap', 43 | 'search-form', 44 | 'search-form-meta', 45 | 'search-form-input', 46 | 'nav-primary', 47 | 'nav-secondary', 48 | 'nav-header', 49 | 'nav-link-wrap', 50 | 'nav-link', 51 | 'entry', 52 | 'entry-image', 53 | 'entry-image-widget', 54 | 'entry-image-grid-loop', 55 | 'entry-author', 56 | 'entry-author-link', 57 | 'entry-author-name', 58 | 'entry-time', 59 | 'entry-modified-time', 60 | 'entry-title', 61 | 'entry-content', 62 | 'comment', 63 | 'comment-author', 64 | 'comment-author-link', 65 | 'comment-time', 66 | 'comment-time-link', 67 | 'comment-content', 68 | 'author-box', 69 | 'sidebar-primary', 70 | 'sidebar-secondary', 71 | 'site-footer', 72 | ); 73 | 74 | $elements = apply_filters( 'be_remove_schema_elements', $elements ); 75 | 76 | foreach( $elements as $element ) { 77 | add_filter( 'genesis_attr_' . $element, 'be_remove_schema_attributes', 20 ); 78 | } 79 | } 80 | 81 | /** 82 | * Remove schema attributes 83 | * 84 | */ 85 | function be_remove_schema_attributes( $attr ) { 86 | unset( $attr['itemprop'], $attr['itemtype'], $attr['itemscope'] ); 87 | return $attr; 88 | } 89 | --------------------------------------------------------------------------------