• After updating to WordPress 4.4.1, the following error is displayed above images on [my WordPress installation](https://thesheetnews.com/):

    Warning: strpos(): Empty needle in /home/content/p3pnexwpnas01_data01/20/2227620/html/wp-includes/media.php on line 1088

    I’m not much of a PHP person myself, but a bit of Stack Overflow searching and such suggested that there’s a missing space before a comma in that line. I disabled all my plugins and the issue persists. Any ideas?

Viewing 13 replies - 1 through 13 (of 13 total)
  • You can try this,
    Download fresh copy of wordpress and replace your media.php file with newly downloaded file….

    Hey Penderworth… having the same problem. Were you able to figure it out?

    Hi,

    Have you tried to use another theme to test with. In a few cases, sometimes switching to a different theme fixes the glitch, unless of course the theme has issues.

    Thread Starter Penderworth

    (@penderworth)

    Hi again folks. I just wanted to update you on what’s going on. I use MediaTemple for hosting, and they don’t allow me to modify the wp-includes directory so I’ve contacted them about the issue to see if there’s anything they can do to help out. In the meantime, I can’t replace the media.php file or fix any of the code in it because I can’t modify it. I tried a different theme to no avail.

    If you have any other ideas they are much appreciated.

    Hey Penderworth – having the same issue as we have our site hosted with GoDaddy and cannot access the wp-includes directory. Will let you know if we were able to figure out a workaround.

    I have root access and replaced the media.php file with no joy ..I still get the warning in my error log.

    herrstrietzel

    (@15broetchenmann)

    Hi Penderworth,
    this is an annoying bug caused by the new (wp 4.4) responsive images feature (which is of course a great improvement).

    For some reason it has issues with image classes:
    1. Option: Try to disable the responsive image feature by adding this snippet to your function.php

    function disable_srcset( $sources ) {
    return false;
    }
    add_filter( 'wp_calculate_image_srcset', 'disable_srcset' );

    2. Option: Remove classes from thumbnail sized image elements:

    /*remove class from the_post_thumbnail*/
    
    function the_post_thumbnail_remove_class($output) {
    	$output = preg_replace('/class=".*?"/', '', $output);
    	return $output;
    }
    add_filter('post_thumbnail_html', 'the_post_thumbnail_remove_class');

    3. Option: Manually search for inserted images with classes assigned.
    In my case it were particularly the “wp-image-123x” classes.

    Try to delete any image class i.e. in your post:
    https://thesheetnews.com/2016/01/29/death-valley-blooms-early/

    Is the error message still showing up?

    I’m getting this error all over the place too. None of the above fixed it yet. It is related to images that are small though. Unfortunately I’ve got too many to fix all of them individually.

    Wondering if anyone has come up with another solution?

    PS When googling this error I’m seeing TONS of websites with the same error that they probably don’t even realize they have yet. Hope WP fixes soon!

    Sue

    (@bunster101)

    I have this issue on one of my sites too. While none of the fixes above worked for me, I could at least suppress the warnings from displaying on the site.

    I followed the steps in the Codex page to log all errors, notices, and warnings to a file called debug.log in the wp-content directory. It also hides the errors so they do not interrupt page generation.

    Codex Page

    Hopefully that helps someone else.

    lnvndrhydn

    (@lnvndrhydn)

    Sue, thanks. Yes, it’s a bandaid, but it definitely helped.

    I’m getting the same error. None of the fixes above worked. I just spent 12 hours removing classes from one area of the site, but the errors are still logging from Woocommerce classes on thumbnails, which can’t be removed.

    Kinda wish I’d checked that 12 hours ago now. Any news on a fix for this yet?

    I also have this problem…is WordPress working on fixing this bug?

    Editing the wp-config and adding the following line did it for me:

    @ini_set('display_errors', 0);

    Blogged: WordPress Error “Empty needle” in media.php Line 1088. How to Hide the Warning Message in Web Pages?

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Warning: strpos(): Empty needle above images’ is closed to new replies.