• Resolved werdtothedee

    (@werdtothedee)


    Is there a way to get the website’s share preview image to show? It seems this plugin is blocking any SEO Share Preview Image. Sharing the website url on twitter isn’t showing the image we uploaded for the preview image. (We have the subscriber form set up to collect emails we need a preview image to show up when we share the link though).

Viewing 1 replies (of 1 total)
  • Hello,

    You don’t see the image because WPMM uses a custom template for the maintenance mode page, and the SEO plugins have no idea about how to embed the image in that custom template.

    The only way to add a social preview image is to add the meta tags programmatically.

    Disclaimer: do not try if you are just a basic WordPress user.

    
    add_filter('wpmm_status_code', function($http_code) {
    	if(!empty($_SERVER['HTTP_USER_AGENT']) && stristr($_SERVER['HTTP_USER_AGENT'], 'twitterbot')) {
    		return 200;
    	}
    	
    	return $http_code;
    }, 10, 1);
    
    // you have to change twitter:title and twitter:image values
    add_action('wpmm_head', function() {
        print('<meta name="twitter:card" content="summary_large_image" />');
        printf('<meta name="twitter:title" content="%s" />', esc_attr('here should be a title'));
        printf('<meta name="twitter:image" content="%s" />', esc_url('here should be the url of the social preview image'));
    }, 10, 1);
    

    Add the code to the end of functions.php (a file that can be found in your active theme folder).


    George

    • This reply was modified 5 years, 9 months ago by George J.
Viewing 1 replies (of 1 total)

The topic ‘Share Preview Image’ is closed to new replies.