• Hey,

    i’ve set my website to php 8.0 but then there are some warnings, mostly on duplicate posts or move posts to trash or reverse:

    First is

    Warning: Attempt to read property “ID” on null …
    for line 25
    if ( get_post_status( $post->ID ) === 'auto-draft' ) {

    and then on the “update” line:

    Undefined array key “add_custom_body_class”
    Line 28

    update_post_meta( $post->ID, "add_custom_body_class", sanitize_text_field( $_POST[ "add_custom_body_class" ] ) );

  • The topic ‘Warnings with PHP 8.0 – post->ID’ is closed to new replies.