Simple Basic Contact Form
[resolved] Form's action attribute automatically set to be URL of most recently-posted post (5 posts)

  1. snthr
    Posted 3 years ago #

    Hi, I’m using this plugin on this page. If you view source, you can see that the URL assigned to the form’s action attribute is the URL of the most recently-posted blog post, instead of being the front page of the site. Is there any way to set this to be the front page, or alternatively to redirect users of the form back to the front page after they fill out the form?

    I’m hoping I haven’t missed something obvious here – I’m a little stumped!

    Any help would be great. Thanks.


  2. Jeff Starr
    Plugin Author

    Posted 2 years ago #

    Redirecting to the home page or some other fixed URL is straightforward, just add either of these lines:

    wp_redirect(home_url()); exit;
    wp_redirect('http://example.com/somewhere/'); exit;

    ..add them just beneath either this line:

    if ($carbon == 1) mail($email, $topic, $fullmsg, $headers);

    ..or this line (depending on which method you are using):

    if ($carbon == 1) wp_mail($email, $topic, $fullmsg, $headers);

    Redirecting to the latest post should be do-able using similar logic and the wp_get_recent_posts function:


  3. snthr
    Posted 2 years ago #

    Hi Jeff,

    Thanks for the reply. Just a point: should I edit this in the plugin files themselves? That is, below the point where you say “NO EDITING REQUIRED - PLEASE SET PREFERENCES IN THE WP ADMIN!”

    What happens if I update the plugin? Won’t it overwrite my edits and re-create the original problem?


  4. Jeff Starr
    Plugin Author

    Posted 2 years ago #

    Yes that is correct. Definitely don't edit the plugin files if you are not comfortable doing so. Also, I'm working on a "Pro" version of the plugin that will provide further options for redirecting users after submissions, errors, etc.

  5. snthr
    Posted 2 years ago #

    Ok, thanks for the clarification.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Simple Basic Contact Form
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic