• Resolved twahlin

    (@twahlin)


    Hello!

    Big fan of this plugin.

    I’m looking to update the og:image URL if an ACF field is not empty on a custom post type. I think I’m pretty close, but just need to figure out what TSF variable/param(?) to use in order to update the URL. Here’s what I’ve got so far:

    add_filter( 'the_seo_framework_image_generation_params', function( $params = [], $context = 'social', $args = null ) {
      // Let's not mess with non-social sharing images.
      if ( 'social' !== $context ) return $params;
    
      if (get_field('usage_image')) {
        $usage_image_url = get_field('usage_image')['url'];
        echo $usage_image_url;
        //The above url needs to replace the og:image and twitter:image url.
      }
    
      $params['size'] = 'social-share-img_larger_x1';
    
      return $params;
    } );

    Thank you for your time & consideration!

    • This topic was modified 4 years, 2 months ago by twahlin.

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

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change og:image URL if ACF Field is not empty’ is closed to new replies.