• Resolved commuter

    (@commuter)


    PHP Notice: Trying to get property ‘ID’ of non-object in /public_html/wp-content/plugins/widget-options/includes/widgets/display.php on line 230
    [14-Sep-2022 00:41:13 UTC] PHP Notice: Trying to get property ‘post_title’ of non-object in /public_html/wp-includes/class-wp-query.php on line 4188
    [14-Sep-2022 00:41:13 UTC] PHP Notice: Trying to get property ‘post_name’ of non-object in /public_html/wp-includes/class-wp-query.php on line 4190

    the line below doesn’t check for the existence of $post which is causing the error.
    $pageID = ($hasWPML) ? apply_filters( ‘wpml_object_id’, $post->ID, $post->post_type, true, $default_language ) : $post->ID;

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mej de Castro

    (@mej)

    Gotcha! We will update. Thanks @commuter for letting us know!

    Plugin Author Mej de Castro

    (@mej)

    Hi @commuter

    On the plugin files, can you please replace:

    $pageID = ($hasWPML) ? apply_filters( ‘wpml_object_id’, $post->ID, $post->post_type, true, $default_language ) : $post->ID;

    with

    $page_id = get_queried_object_id();
    $pageID = ($hasWPML) ? apply_filters( ‘wpml_object_id’, $page_id, ‘page’, true, $default_language ) : $page_id;

    Thank you and please let me know how it goes.

    -Mej

    Thread Starter commuter

    (@commuter)

    yep that’s fixed the notices. i’m unsure however if that code now works differently in terms of functionality, but i’ll leave that for you to figure out.

    Plugin Author Mej de Castro

    (@mej)

    Great! Thanks, @commuter !

    We tested it also on our dummy sites with different set up. We will include this on our next release.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘please fix these php notices’ is closed to new replies.