• Resolved nickyjacobo

    (@nickyjacobo)


    screenshot: https://prntscr.com/uugb0p

    Do you have documentation how I can replace the value of og:image instead of adding a new one? as you can see on the screenshot it added new og:image instead of replacing. I’m having a hard time on this, this was so easy on previous version using opengraph image. I also read this https://github.com/Yoast/wordpress-seo/issues/14698 but I dont get how I can replace the value.

    This is my code:

    use Yoast\WP\SEO\Presenters\Abstract_Indexable_Presenter;
    
    class My_Presenter extends Abstract_Indexable_Presenter {
      public function present() {
        return '<meta property="og:image" content="//d1id9ov24n1lx4.cloudfront.net/wp-content/uploads/2019/05/21155632/eview_home_hero.jpg" />';
      }
    
      public function get() {
    	// return $this->presentation->open_graph_image === 'nl_NL' ) ? 'Dutch' : 'Not dutch';
      }
    }
    
    function add_my_presenter( $presenters ) {
      $presenters[] = new My_Presenter();
      return $presenters;
    }
    
    add_filter( 'wpseo_frontend_presenters', 'add_my_presenter' );

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Jerlyn

    (@jerparx)

    Hi @nickyjacobo ,

    Please check this documentation if you want to add a new metadata presenter.

    Regarding the code that you’re using, unfortunately, we can’t offer support on custom code since we don’t want to take the risk that we break your website by suggesting incorrect or incomplete code. Maybe someone watching these forums can assist you further.

    Plugin Support Jerlyn

    (@jerparx)

    Hi @nickyjacobo ,

    We’re closing this thread as there seem no further questions from you. Please feel free to open a new thread should you have further concerns.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘I want wpseo_frontend_presenters replace og:image value instead of adding’ is closed to new replies.