• We are getting the following error:

    Warning: Invalid argument supplied for foreach() in /home/username/public_html/wp-content/plugins/jetpack/modules/publicize/enhanced-open-graph.php on line 49

    This only happens when Publicize is activated and we use the Slideshow format of gallery. Other galleries are working.

    Doing a search for this on Google it looks like lots of sites have been affected.

    Jetpack 3.0.1 is installed.

    https://wordpress.org/plugins/jetpack/

Viewing 7 replies - 1 through 7 (of 7 total)
  • same issue; everything is up to date (theme, plugins, etc) and seeing this issue as well. will post when fixed.

    Hey,
    I got the same error, sort of got a hack that might fix it error at least it did for me. All I did was comment out the lines of code in enhanced-open-graph.php. Line 49 is a function, so make sure you comment out the whole function. I tried this, the error seem to resolve itself, and their hasn’t been other errors from the code change.

    Hi guys, any follow-up on this? Seems to be widespread. Can’t find the file to edit under Jetpack in WordPress’ plugins edit menu, weirdly.

    Hello,
    I have the same problem.
    Is there any solution?
    thanks

    This issue affected one of our sites. We actually don’t use Publicize, but the issue appeared after using slideshows for our galleries, instead of just laying them all out in columns. The error code only appeared I want to say on pages using the slideshows, but I could always recheck.

    What I ended up doing was temporarily editing the plugin’s php file until the plugin is updated to correct this error.

    Disclaimer: I’m in no way affiliated with this plugin and am obviously not responsible for any issues you may encounter, so please back up before you make any changes!!!

    1. In the WordPress Dashboard, go to Plugins > Editor > Select Jetpack for WordPress.com to edit plugin > Then scroll until you see “jetpack/modules/publicize.php.” You’ll then want to click on “jetpack/modules/publicize/enhanced-open-graph.php.”

    2. Jump to Line 49 as mentioned in the error and delete the code around it, or look for:

    /**
     * Better OG Image Tags for Gallery Post Formats
     */
    function enhanced_og_gallery( $tags ) {
    	if ( !is_singular() || post_password_required() )
    		return $tags;
    
    	global $post;
    
    	// Always favor featured images.
    	if ( enhanced_og_has_featured_image( $post->ID ) )
    		return $tags;
    
    	$summary = Jetpack_Media_Summary::get( $post->ID );
    
    	if ( 'gallery' != $summary['type'] )
    		return $tags;
    
    	$images = $secures = array();
    	foreach ( $summary['images'] as $i => $image ) {
    		$images[] = $image['url'];
    		$secures[] = $summary['secure']['images'][$i]['url'];
    	}
    
    	$tags['og:image'] = $images;
    	$tags['og:image:secure_url'] = $secures;
    
    	return $tags;
    }
    add_filter( 'jetpack_open_graph_tags', 'enhanced_og_gallery' );

    3. Delete that text and click Update File. Check your site and see if that removed the error text!

    Afterwards, I logged out and took a look to see if everything still looked OK. From what I’m seeing everything seems to work. I also logged back in and did some more work to ensure all was well. If anything, it may affect open-graph data for SEO? No idea. I just needed the error message gone!

    Should I encounter any further errors, I’ll be sure to let you know.

    People: If you require assistance then, as per the Forum Welcome, please post your own topics instead of tagging onto someone else’s topic.

    The probability of a topic being successfully resolved is inversely proportional to the number of people jumping in with “Me too” posts.

    Thanks troyoda,

    The problem is solved by commeting the foreach section.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Slideshow Error when Publicize is activated’ is closed to new replies.