• Resolved gavin310

    (@gavin310)


    I just started getting a new warning message and Query Monitor says it’s coming from Relevanssi. The warning is:

    Notice: Undefined index: file in /Users/gavin/Local Sites/weo/app/public/wp-includes/media.php on line 1676

    The warning is because $image_meta[‘file’] doesn’t exist. When I print_r($image_meta) I get this:

    Array
    (
    [sizes] => Array
    (
    [full] => Array
    (
    [file] => InsuranceReqs_CO_2009-pdf.jpg
    [width] => 1088
    [height] => 1408
    [mime-type] => image/jpeg
    [filesize] => 174701
    )
    [medium] => Array
    (
    [file] => InsuranceReqs_CO_2009-pdf-1024×1325.jpg
    [width] => 1024
    [height] => 1325
    [mime-type] => image/jpeg
    [filesize] => 145210
    )
    [thumbnail] => Array
    (
    [file] => InsuranceReqs_CO_2009-pdf-198×256.jpg
    [width] => 198
    [height] => 256
    [mime-type] => image/jpeg
    [filesize] => 11646
    )
    )
    [filesize] => 28270
    )

    InsuranceReqs_CO_2009.pdf is a PDF file in our Media Library, so I’m assuming these JPEGs are thumbnails that were automatically generated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mikko Saari

    (@msaari)

    What makes you think this is coming from Relevanssi? That file reference is WordPress core, not Relevanssi. Can you please provide more information about how this is linked to Relevanssi?

    Thread Starter gavin310

    (@gavin310)

    Thanks for the quick reply. I’m just going off of what Query Monitor is telling me. Under “Component” it says “Plugin: relevanssi” for this error.

    Plugin Author Mikko Saari

    (@msaari)

    Can you please show me more information? This isn’t enough for me to say anything about this. Perhaps share a screenshot of the Query Monitor display? I can’t link this to anything Relevanssi does. When are you getting this error? During searches?

    Thread Starter gavin310

    (@gavin310)

    Sorry about that. The error shows on the search results page even before any headers have been sent. When Relevanssi is disabled the error goes away.

    Here’s the “Location” of the error in Query Monitor:

    wp-includes/media.php:1676
    wp_image_add_srcset_and_sizes()
    wp-includes/media.php:2010
    wp_img_tag_add_srcset_and_sizes_attr()
    wp-includes/media.php:1838
    wp_filter_content_tags()
    wp-includes/class-wp-hook.php:307
    apply_filters('the_content')
    wp-content/plugins/relevanssi/lib/excerpts-highlights.php:138
    relevanssi_do_excerpt()
    wp-content/plugins/relevanssi/lib/excerpts-highlights.php:1531
    relevanssi_add_excerpt()
    wp-content/plugins/relevanssi/lib/search.php:672
    relevanssi_do_query()
    wp-content/plugins/relevanssi/lib/search.php:84
    relevanssi_query()
    wp-includes/class-wp-hook.php:307
    apply_filters_ref_array('posts_pre_query')
    wp-includes/class-wp-query.php:3055
    WP_Query->get_posts()
    wp-includes/class-wp-query.php:3586
    WP_Query->query()
    wp-includes/class-wp.php:648
    WP->query_posts()
    wp-includes/class-wp.php:775
    WP->main()
    wp-includes/functions.php:1330
    wp()
    wp-blog-header.php:16

    I actually thought it was clear it was coming from Relevanssi, but if it’s not please let me know so I can try to dig in deeper first.

    Plugin Author Mikko Saari

    (@msaari)

    Relevanssi triggers this warning, but it’s not coming from Relevanssi. It’s happening when Relevanssi creates the excerpts and runs the_content filters on the post content, but the actual error is coming from the core wp_image_add_srcset_and_sizes() function. I’m not sure why the array index would be missing from the image meta; Relevanssi does not interact with this directly.

    Thread Starter gavin310

    (@gavin310)

    Ok, thanks. Sorry for the confusion.

    Thread Starter gavin310

    (@gavin310)

    Just following up. I deleted the PDF file and re-uploaded it and the problem went away. No idea what was causing it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘New warning coming from Relevanssi: Undefined index: file’ is closed to new replies.