Events Made Easy Forums Generic an update to the Yoast FAQ?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #60722
    Anonymous
    Inactive

    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/&#8221; />
    <script type=’application/ld+json’ class=’yoast-schema-graph yoast-schema-graph–main’>{“@context”:”https://schema.org&#8221;,”@graph”:[{“@type”:”Organization”,”@id”:”https://neohgolf.com/#organization&#8221;,”name”:”Northeast Ohio Golf”,”url”:”https://neohgolf.com/&#8221;,”sameAs”:[“https://facebook.com/NortheastOhioGolf&#8221;,”https://linkedin.com/groups/7021248&#8243;,”https://twitter.com/NEOHgolf”%5D,”logo&#8221;:{“@type”:”ImageObject”,”@id”:”https://neohgolf.com/#logo&#8221;,”url”:”https://neohgolf.com/wp-content/uploads/2016/08/NEOHgolf-logo-300sqTRANS.png&#8221;,”width”:300,”height”:300,”caption”:”Northeast Ohio Golf”},”image”:{“@id”:”https://neohgolf.com/#logo&#8221;}},{“@type”:”WebSite”,”@id”:”https://neohgolf.com/#website&#8221;,”url”:”https://neohgolf.com/&#8221;,”name”:”Northeast Ohio Golf”,”description”:”Golf News, Tournament and Course Information for Greater Cleveland, Akron, Canton, Youngstown, Elyria”,”publisher”:{“@id”:”https://neohgolf.com/#organization&#8221;},”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&#8221;,”url”:”https://neohgolf.com/events/&#8221;,”inLanguage”:”en-US”,”name”:”SponsorCo 2-M Better Ball | Northeast Ohio Golf”,”isPartOf”:{“@id”:”https://neohgolf.com/#website&#8221;},”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!

    #61063
    Franky
    Keymaster

    Yoast 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 …

    #61064
    Anonymous
    Inactive

    For 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!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Generic’ is closed to new topics and replies.
Scroll to Top