{"id":1131251,"date":"2016-06-23T15:34:10","date_gmt":"2016-06-23T22:34:10","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/"},"modified":"2016-06-23T15:34:10","modified_gmt":"2016-06-23T22:34:10","slug":"how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/","title":{"rendered":"How to create a &quot;custom plugin&quot; to remove &quot;Event Archives&quot; from page title"},"content":{"rendered":"<p>https:\/\/theeventscalendar.com\/knowledgebase\/titles-in-yoast-seo\/<\/p>\n<p>I created the custom plugin but when I activated it, I got this error:<\/p>\n<p>The plugin generated 1091 characters of unexpected output during activation. If you notice \u201cheaders already sent\u201d messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.<\/p>\n<p>Here&#8217;s the complete code. What did I do wrong?<\/p>\n<p>&lt;?php<br \/>\n\/*<br \/>\nPlugin Name: The Events Calendar Remove Events Archive from Yoast Page Title<br \/>\n*\/<br \/>\n\/*<br \/>\n* The Events Calendar &#8211; Yoast SEO &#8211; Prevent Yoast from changing Event Title Tags for Event Views (Month, List, Etc,)<br \/>\n* @TEC &#8211; 4.0+<br \/>\n* @Yoast &#8211; 3.1.2<br \/>\n*\/<br \/>\n?&gt;<br \/>\nadd_action( &#8216;pre_get_posts&#8217;, &#8216;tribe_remove_wpseo_title_rewrite&#8217;, 20 );<br \/>\nfunction tribe_remove_wpseo_title_rewrite() {<br \/>\n    if ( class_exists( &#8216;Tribe__Events__Main&#8217; ) &amp;amp;amp;&amp;amp;amp; class_exists( &#8216;Tribe__Events__Pro__Main&#8217; ) ) {<br \/>\n        if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || tribe_is_map() || tribe_is_photo() || tribe_is_week() ) {<br \/>\n            $wpseo_front = WPSEO_Frontend::get_instance();<br \/>\n            remove_filter( &#8216;wp_title&#8217;, array( $wpseo_front, &#8216;title&#8217; ), 15 );<br \/>\n            remove_filter( &#8216;pre_get_document_title&#8217;, array( $wpseo_front, &#8216;title&#8217; ), 15 );<br \/>\n        }<br \/>\n    } elseif ( class_exists( &#8216;Tribe__Events__Main&#8217; ) &amp;amp;amp;&amp;amp;amp; !class_exists( &#8216;Tribe__Events__Pro__Main&#8217; ) ) {<br \/>\n        if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() ) {<br \/>\n            $wpseo_front = WPSEO_Frontend::get_instance();<br \/>\n            remove_filter( &#8216;wp_title&#8217;, array( $wpseo_front, &#8216;title&#8217; ), 15 );<br \/>\n            remove_filter( &#8216;pre_get_document_title&#8217;, array( $wpseo_front, &#8216;title&#8217; ), 15 );<br \/>\n        }<br \/>\n    }<br \/>\n};<\/p>\n","protected":false},"template":"","class_list":["post-1131251","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to create a &quot;custom plugin&quot; to remove &quot;Event Archives&quot; from page title -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create a &quot;custom plugin&quot; to remove &quot;Event Archives&quot; from page title -\" \/>\n<meta property=\"og:description\" content=\"https:\/\/theeventscalendar.com\/knowledgebase\/titles-in-yoast-seo\/ I created the custom plugin but when I activated it, I got this error: The plugin generated 1091 characters of unexpected output during activation. If you notice \u201cheaders already sent\u201d messages, problems with syndication feeds or other issues, try deactivating or removing this plugin. Here&#8217;s the complete code. What did I do wrong? &lt;?php [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/\",\"name\":\"How to create a &quot;custom plugin&quot; to remove &quot;Event Archives&quot; from page title -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-06-23T22:34:10+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"How to create a &quot;custom plugin&quot; to remove &quot;Event Archives&quot; from page title\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to create a &quot;custom plugin&quot; to remove &quot;Event Archives&quot; from page title -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/","og_locale":"en_US","og_type":"article","og_title":"How to create a &quot;custom plugin&quot; to remove &quot;Event Archives&quot; from page title -","og_description":"https:\/\/theeventscalendar.com\/knowledgebase\/titles-in-yoast-seo\/ I created the custom plugin but when I activated it, I got this error: The plugin generated 1091 characters of unexpected output during activation. If you notice \u201cheaders already sent\u201d messages, problems with syndication feeds or other issues, try deactivating or removing this plugin. Here&#8217;s the complete code. What did I do wrong? &lt;?php [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/","name":"How to create a &quot;custom plugin&quot; to remove &quot;Event Archives&quot; from page title -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-06-23T22:34:10+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-create-a-custom-plugin-to-remove-event-archives-from-page-title\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"How to create a &quot;custom plugin&quot; to remove &quot;Event Archives&quot; from page title"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1131251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1131251\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1131251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}