Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • I see this:

    Deprecated: Function wpcf7_remove_shortcode is deprecated since Contact Form 7 version 4.6! Use wpcf7_remove_form_tag instead. in /home/site/public_html/wp-content/plugins/contact-form-7/includes/functions.php on line 529

    Deprecated: Function wpcf7_remove_shortcode is deprecated since Contact Form 7 version 4.6! Use wpcf7_remove_form_tag instead. in /home/site/public_html/wp-content/plugins/contact-form-7/includes/functions.php on line 529

    I’m not much of a dev so I asked Chat to weigh in. They gave me this working code:


    /**
    * Marks a function as deprecated and informs when it has been used.
    *
    * @param string $function_name The function that was called.
    * @param string $version The version of Contact Form 7 that deprecated
    * the function.
    * @param string $replacement The function that should have been called.

    function wpcf7_deprecated_function( $function_name, $version, $replacement ) {
    if ( WP_DEBUG ) {
    if ( function_exists( '__' ) ) {
    trigger_error(
    sprintf(
    /* translators: 1: PHP function name, 2: version number, 3: alternative function name
    __( 'Function %1$s is <strong>deprecated</strong> since Contact Form 7 version %2$s! Use %3$s instead.', 'contact-form-7' ),
    $function_name, $version, $replacement
    ),
    E_USER_DEPRECATED
    );
    } else {
    trigger_error(
    sprintf(
    'Function %1$s is <strong>deprecated</strong> since Contact Form 7 version %2$s! Use %3$s instead.',
    $function_name, $version, $replacement
    ),
    E_USER_DEPRECATED
    );
    }
    }
    }
    */

    function wpcf7_deprecated_function( $function_name, $version, $replacement ) {
    if ( WP_DEBUG ) {
    // Get the backtrace with limited depth for performance
    $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 );

    // Initialize caller information
    $caller_info = '';

    // Check if the backtrace has the caller's file and line
    if ( isset( $backtrace[1]['file'], $backtrace[1]['line'] ) ) {
    $caller_file = str_replace( ABSPATH, '', $backtrace[1]['file'] ); // Make path relative
    $caller_line = $backtrace[1]['line'];
    $caller_info = sprintf( ' in <strong>%s</strong> on line <strong>%d</strong>.', $caller_file, $caller_line );
    }

    // Prepare the deprecation message
    if ( function_exists( '__' ) ) {
    $message = sprintf(
    /* translators: 1: PHP function name, 2: version number, 3: alternative function name */
    __( 'Function %1$s is <strong>deprecated</strong> since Contact Form 7 version %2$s! Use %3$s instead.', 'contact-form-7' ),
    $function_name,
    $version,
    $replacement
    ) . $caller_info;
    } else {
    $message = sprintf(
    'Function %1$s is <strong>deprecated</strong> since Contact Form 7 version %2$s! Use %3$s instead.',
    $function_name,
    $version,
    $replacement
    ) . $caller_info;
    }

    // Trigger the deprecated error with the enhanced message
    trigger_error( $message, E_USER_DEPRECATED );
    }
    }

    Hi- I’m having the same exact issue with cf7 up-to-date version.

    @takayukister any guidance on what we can do to fix this error? Maybe it would be helpful if you could update contact-form-7/includes/functions.php:531 to print where the offending code is? I’m not able to tell since the error is returning as if there’s an issue with cf7.

    Thread Starter jeffrechten

    (@jeffrechten)

    There was a unquoted # in the javascript file that was loaded before jquery. With 4.5, that’s not allowed. Quoting it fixed everything.

    jeffrechten

    (@jeffrechten)

    Thanks for your input, but your username doesn’t have anything to do with security. Not a thing

    While I agree with the mods’ general ideas here, it is a bit erroneous to think that a username doesn’t have anything to do with your security. Without multi-factor authentication, it’s exactly 50% of the “things you must have” equation, albeit the half that’s typically less guarded.

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