WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Contact Form 7] Possible Solution to Recent Bugs (1 post)

  1. shahtrughna
    Member
    Posted 2 years ago #

    Plugin Version: 3.1.1

    Problem:
    When I apply the code into my article, it renders as "404 Not Found". I tried using the old syntax, played around with the syntaxes a bit (using titles, not using quote marks, etc), to no avail. So I dug in a little deeper...

    Solution:
    The plugin isn't playing nicely with WP's shortcode_atts() function. Not only are quote marks being sent as ", but now spaces can no longer be used in form titles. Go into the following file:

    /wp-content/plugins/contact-form-7/includes/controller.php

    Look around line 175, for function wpcf7_contact_form_tag_func(). A little further down, you'll see this line:
    $atts = shortcode_atts( array( 'id' => 0, 'title' => '' ), $atts );

    Add the following two lines above it, so it appears so:

    $atts['id'] = str_replace(array('"','"'),'',$atts['id']);
    $atts['title'] = str_replace(array('"','"'),'',$atts['title']);
    $atts = shortcode_atts( array( 'id' => 0, 'title' => '' ), $atts );

    Also, if you have any forms that have spaces in their titles, you'll need to recreate them using underscores (if you have access to your database you should be able to just edit the existing forms, not sure about this).

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by shahtrughna
  • This topic is not a support question
  • WordPress version: 3.3.1