• Resolved daymobrew

    (@daymobrew)


    [13-Sep-2017 09:56:09 UTC] PHP Notice: wpcf7_add_shortcode is deprecated since Contact Form 7 version 4.6! Use wpcf7_add_form_tag instead. in /wp-content/plugins/contact-form-7/includes/functions.php on line 355

    With the help of Query Monitor I tracked it to the add_shortcode_wpcaptcha() function in hctpc-contact-form-integration.php

    I copied the code from Contact Form 7 Honeypot (https://www.ads-software.com/plugins/contact-form-7-honeypot/). That plugin calls the wpcf7_add_form_tag() function if it is available.

    Here is a patch:
    https://pastebin.com/LvVGP8iu

    — hctpc-contact-form-integration.orig.php 2017-09-13 08:53:03.000000000 +0100
    +++ hctpc-contact-form-integration.php 2017-09-13 11:07:25.286147500 +0100
    @@ -21,7 +21,12 @@
    */
    add_action( ‘wpcf7_init’, ‘add_shortcode_wpcaptcha’ );
    function add_shortcode_wpcaptcha() {
    – wpcf7_add_shortcode( ‘wpcaptcha’, ‘captcha_shortcode’, true );
    + // Test if new 4.6+ functions exists
    + if (function_exists(‘wpcf7_add_form_tag’)) {
    + wpcf7_add_form_tag( ‘wpcaptcha’, ‘captcha_shortcode’, true );
    + } else {
    + wpcf7_add_shortcode( ‘wpcaptcha’, ‘captcha_shortcode’, true );
    + }
    }

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

    The next version is coming out monday with the fix for this.

    Thanks

    Pls refer .

    vagrant@vvv:/srv/www/wordpress-default/public_html/wp-content$ grep -rn ‘wpcf7_add_shortcode’ .

    ./plugins/captcha/hcptch-contact-form-integration.php:14: wpcf7_add_shortcode( ‘wpcaptcha’, ‘captcha_shortcode’, true );

    ./plugins/captcha/hctpc-contact-form-integration.php:24:
    wpcf7_add_shortcode( ‘wpcaptcha’, ‘captcha_shortcode’, true );

    Sorry poor english .

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wpcf7_add_shortcode deprecated since CF7 v4.6. Causes PHP notice’ is closed to new replies.