WordPress.org

Ready to get started?Download WordPress

Forums

Visual Tab deletes form options (3 posts)

  1. rwerther
    Member
    Posted 2 years ago #

    Hello.
    I'm having the issue where I have a custom form in one of my pages, and when I switch to the Visual tab, many of my form options are deleted. Any suggestions on how to fix this?

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    Don't switch editing tabs. If you have used the HTML tab, stick to it. Otherwise your markup will be wiped out by the Visual Editor. This is just an unfortunate side effect of the TinyMCE editor and I don't see it changing any time soon.

  3. You can include forms in your template files to avoid this issue - no worry about code getting stripped or formatting going wonky.

    For example, in page.php below the loop you can add:

    <?php if ( is_page('contact') ):
         include("myform.php");
         endif;
    ?>

    ...and create a separate file called myform.php where you have your form code. This will include the form code on the page with the slug 'contact' only.

Topic Closed

This topic has been closed to new replies.

About this Topic