Support » Plugin: Honeypot for Contact Form 7 » wpcf7_add_shortcode deprecation

  • wpcf7_add_shortcode has been deprecated since CF 4.6
    It recommends to switch to wpcf7_add_form_tag instead. Do you have plans to do so to make sure this plugin will remain functional after the next CF7 upgrade? (And in order for the message to stop spamming our debug.log ;))

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ryan


    You bet! Will add it to the changes for the next version. Thanks for the reminder.

    Plugin Author Ryan


    FINALLY got around to investigating this further and realized the plugin has been using wpcf7_add_shortcode since version 1.10 of this plugin. You shouldn’t be seeing errors in your logs about it. The only reason it would be popping up in the logs that I can figure is if you are using an older version of CF7 that doesn’t yet support wpcf7_add_form_tag, and thus requires wpcf7_add_shortcode for backwards compatibility. What version of CF7 are you running?

    Oh my, I don’t remember which site it was.

    It’s just weird though, how could CF7 complain that a deprecated function was used if it didn’t supply wpcf7_add_form_tag yet? That wouldn’t make any sense IMHO.

    Plugin Author Ryan


    You’re right, that doesn’t make sense. I’m really not sure what could have caused it. Maybe it wasn’t an updated version (pre-v1.10) of the Honeypot plugin? Here’s the code that’s been in place since v1.10, released about 3 years ago.

    I have verbose logging on, and couldn’t reproduce the depreciation message in the logs. If you happen to remember the wording of the error, I can dig in a bit more. Here’s the conditional that handles this (for backwards compatibility):

    add_action('wpcf7_init', 'wpcf7_add_form_tag_honeypot', 10);
    function wpcf7_add_form_tag_honeypot() {
      // Test if new 4.6+ functions exists
      if (function_exists('wpcf7_add_form_tag')) {
            'name-attr' => true, 
            'do-not-store' => true,
            'not-for-mail' => true
      } else {
        wpcf7_add_shortcode( 'honeypot', 'wpcf7_honeypot_formtag_handler', true );
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.