• Resolved altcode

    (@altcode)


    After updating to Contact Form 7 6.1.5 the following deprecation notice appears on every page that contains a multi-step form:

    Deprecated: id property of a WPCF7_ContactForm object is no longer accessible. Use id() method instead. in /wp-includes/functions.php on line 6131
    The cause is in inc/frontend/init.php, line 58, inside the cf7mls_multistep_shortcode_callback() function:
    $cf7_id = $contact_form->id;

    In CF7 6.x, the id property on WPCF7_ContactForm was made protected and accessing it directly via ->id triggers a deprecation. The fix is to use the public method instead:
    $cf7_id = $contact_form->id();

    Also worth noting: line 59 checks if ( empty( $contact_form ) ) after ->id has already been accessed on line 58, so the null check comes too late. Swapping the order would prevent a potential fatal error if wpcf7_get_current_contact_form() returns null.

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

You must be logged in to reply to this topic.