• Resolved nztim

    (@nztim)


    Hi,

    I am using the special mail tags [_post_name] and [_post_title] in my contact form email and most of the time this works perfectly. However, once in about 10-15 messages the email comes through without the post name and title, it actually has the text “[_post_name]” and “[_post_title]” instead of the post slug and title.

    I can’t reproduce the problem by filling out the form myself, but it’s been happening consistently and over a number of updates. It does however appear to be getting worse.

    The form shortcode is embedded in the template file, and it’s located inside the Loop.

    I’ve already tried to find out the browser/OS of a user who submitted a form resulting in this issue, and the first answer I got was Windows/IE…so that’s not much help.

    I’m wondering if anyone can give me a suggestion about how to troubleshoot this. Alternatively, is there another way to include the slug and title in the form data?

    Thanks for reading ??

    https://www.ads-software.com/plugins/contact-form-7/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Put [_url] additionally, then check where the mail is actually coming from.

    Thread Starter nztim

    (@nztim)

    Thanks for your reply. I put the [_url] tag in and found that in fact it does function on the occasions when the [_post_name] and [_post_title] tags fail.

    Of course I tried the form on that page and the tags worked normally in my test.

    Nevertheless this is potentially a solution, as the URL can identify the post instead of the [_post_name], but the slug is the information required by the receiving system and the post title is also very useful, so it would be much better to continue to use [_post_name] and [_post_title] if they worked consistently.

    Do you think there any way to figure out the reason or circumstances causing these two tags to fail?

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    So I mean the [_url] will give you a clue when the [_post_name] and [_post_title] fail. I didn’t mean using [_url] in substitution for [_post_name] and [_post_title].

    I guess you have pages that contain contact form shortcodes outside the WP loop. Find the page by using [_url].

    Thread Starter nztim

    (@nztim)

    Thanks again for responding. This form is only used on one specific page template. The shortcode is embedded in the page template file, and it’s inside the Loop. So there are no variations in the placement of this form.

    As mentioned above, in most cases it works but occasionally it fails. So far today there are 23 submissions and two have exhibited this problem. When I try the form on the pages concerned it works OK for me.

    Do you think it has to do with the user environment? Any further suggestions for troubleshooting would be appreciated.

    Thread Starter nztim

    (@nztim)

    I think I’ve figured this out:

    The website pages containing this form are updated by an automated process that deletes and re-adds them.

    If a page is loaded and left open in the browser while an update occurs, and the form submitted after the originating page has been deleted and re-created, the [_post_name] and [_post_title] tags will fail.

    Presumably this is because even though the post appears the same, the original post ID will no longer be valid. It also explains why the URL parameter works when the post variables do not.

    So thank you for your suggestions, they were very helpful ??

    Thread Starter nztim

    (@nztim)

    For anyone reading this, my immediate solution is to add hidden fields for the post name and title, and automatically fill these with Javascript on page load. This means the post slug and title will always be passed through.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Special mail tags intermittently not working’ is closed to new replies.