• Resolved dmcclain

    (@dmcclain)


    Metaslider Version 3.23.3
    MetaSlider – Pro Add-on Pack Version 2.18.3

    Last week our site began to have serious layout issues, and we also noticed the error message on the page linked above. Error logs show a similar issue,
    PHP Notice: Undefined variable: _post in /var/www/html/wordpress/wp-content/themes/grady/template-parts/degree-faculty.php on line 52
    line 52 is
    $post_thumb = get_the_post_thumbnail_url( $_post->ID, 'full' );

    When I deactivated Metaslider and the Add-on Pack, the layout issue resolved itself but the error message on the story link stayed.

    Could the recent Metaslider code update be causing this? The only other plugin we’ve had update in the last week was Advanced Custom Fields, and those devs do not think they’re causing our issues.

    Our theme was built by a local company that went out of business during the pandemic, so I’m investigating this rather blindly. Thanks for any help you can provide!

    -don

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    The link you provided doesn’t seem to have MetaSlider activated at all. The error isn’t also related to MetaSlider.

    If you take a closer, the error is pointed out to the your theme.

    Although the issue is not related to MetaSlider, you can try fixing it by updating that line to
    $post_thumb = get_the_post_thumbnail_url( $post->ID, 'full' );
    or
    $post_thumb = get_the_post_thumbnail_url( get_the_ID, 'full' );

    Thread Starter dmcclain

    (@dmcclain)

    Thank you so much for your attention.

    Your suggestion did help me fix one error, I am grateful.

    I still don’t know what caused our errors, nothing updated on our site except for the two plugins, but for now things seem stable. I wonder if this has anything to do with PHP itself, I will continue investigating.

    Thanks again!

    -don

    $post should be known in the context as a global for the first line to work.

    And since get_the_ID is a function, the second line would be:

    $post_thumb = get_the_post_thumbnail_url( get_the_ID(), 'full' );

    Thread Starter dmcclain

    (@dmcclain)

    @galbaras, thank you so much for your reply to this ticket!

    I’m still not sure what has updated to cause these errors to crop up suddenly, but in the last couple of weeks I’ve used your code suggestion to repair 4 different pages.

    I didn’t write the original code, in fact I’m struggling to understand any of this ?? but I am so grateful you took the time to help me out.

    -don

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Recent update causing post_ID errors?’ is closed to new replies.