Events Made Easy › Forums › Generic › an update to the Yoast FAQ?
Tagged: yoast canonical, yoast json script
- This topic has 2 replies, 2 voices, and was last updated 4 years, 8 months ago by Anonymous.
-
AuthorPosts
-
Mon 30 Mar 2020 at 23:16 #60722AnonymousInactive
I implemented the child theme per the FAQs page to exclude Yoast from the Event and Locations pages. [https://www.e-dynamics.be/wordpress/faq/]
It worked to delete most of the Yoast content (thank you!).
But there are still a couple of bad content pieces left from Yoast: an incorrect canonical link reference; and some duplicate json script data:
<!– This site is optimized with the Yoast SEO plugin v12.9.1 – https://yoast.com/wordpress/plugins/seo/ –>
<!– Admin only notice: this page does not show a meta description because it does not have one, either write it for this page specifically or go into the [SEO – Search Appearance] menu and set up a template. –>
<meta name=”robots” content=”max-snippet:-1, max-image-preview:large, max-video-preview:-1″/>
<link rel=”canonical” href=”https://neohgolf.com/events/” />
<script type=’application/ld+json’ class=’yoast-schema-graph yoast-schema-graph–main’>{“@context”:”https://schema.org”,”@graph”:[{“@type”:”Organization”,”@id”:”https://neohgolf.com/#organization”,”name”:”Northeast Ohio Golf”,”url”:”https://neohgolf.com/”,”sameAs”:[“https://facebook.com/NortheastOhioGolf”,”https://linkedin.com/groups/7021248″,”https://twitter.com/NEOHgolf”%5D,”logo”:{“@type”:”ImageObject”,”@id”:”https://neohgolf.com/#logo”,”url”:”https://neohgolf.com/wp-content/uploads/2016/08/NEOHgolf-logo-300sqTRANS.png”,”width”:300,”height”:300,”caption”:”Northeast Ohio Golf”},”image”:{“@id”:”https://neohgolf.com/#logo”}},{“@type”:”WebSite”,”@id”:”https://neohgolf.com/#website”,”url”:”https://neohgolf.com/”,”name”:”Northeast Ohio Golf”,”description”:”Golf News, Tournament and Course Information for Greater Cleveland, Akron, Canton, Youngstown, Elyria”,”publisher”:{“@id”:”https://neohgolf.com/#organization”},”potentialAction”:{“@type”:”SearchAction”,”target”:”https://neohgolf.com/?s={search_term_string}”,”query-input”:”required name=search_term_string”}},{“@type”:”WebPage”,”@id”:”https://neohgolf.com/events/#webpage”,”url”:”https://neohgolf.com/events/”,”inLanguage”:”en-US”,”name”:”SponsorCo 2-M Better Ball | Northeast Ohio Golf”,”isPartOf”:{“@id”:”https://neohgolf.com/#website”},”datePublished”:”2011-02-04T02:28:10+00:00″,”dateModified”:”2020-01-25T16:09:50+00:00″}]}</script>
<!– / Yoast SEO plugin. –>Is there any addition that can be made to the FAQs-suggested functions.php child theme file to strip out those two bad pieces?
Thank you Franky!
Mon 30 Mar 2020 at 23:38 #61063FrankyKeymasterYoast is a PITA … whatever you find on the net is no longer valid some time after. In the past this worked (and I still have that in EME):
global $wpseo_front; if (isset($wpseo_front)) remove_action( 'wp_head', array($wpseo_front, 'head'), 2 );
but apparently that no longer works. I took a look at https://yoast.com/wordpress/plugins/seo/api/ and updated the FAQ accordingly. Maybe worth a test, but if not working you might want to check with the yoast guys …
Tue 31 Mar 2020 at 16:06 #61064AnonymousInactiveFor what it’s worth, per the new Yoast FAQs at https://www.e-dynamics.be/wordpress/faq/ I removed the “EME | Settings | Other | Extra event html headers” as directed.
My event and location pages appear to show one canonical and one set of opengraph tags, which look good to me (not an expert eye though).
But instead of the functions.php codes listed on your faq page, I still have an older version of your code in place in my child theme:
add_action('wp_head', 'remove_all_wpseo_og', 1); function remove_all_wpseo_og() { if ( eme_is_single_event_page() || eme_is_single_location_page() ) { remove_action( 'wpseo_head', array( $GLOBALS['wpseo_og'], 'opengraph' ), 30 ); } } add_action('wp_head', 'remove_all_wpseo_twitter', 1); function remove_all_wpseo_twitter() { if ( eme_is_single_event_page() || eme_is_single_location_page() ) { remove_action( 'wpseo_head' , array( 'WPSEO_Twitter' , 'get_instance' ) , 40 ); } } add_filter( 'wpseo_canonical', 'yoast_remove_canonical_items' ); function yoast_remove_canonical_items( $canonical ) { if ( is_page ( 3475 ) ) { return false; } /* Use a second if statement here when needed */ return $canonical; /* Do not remove this line */ } add_filter( 'wpseo_title', 'eme_html_title' );
It works for now, so I plan to leave it as-is until I see an issue. Thank you Franky!
-
AuthorPosts
- The forum ‘Generic’ is closed to new topics and replies.