• Resolved johnytayds

    (@johnytayds)


    Is it any way to delete Subject from the contact form on specific advert’ site?
    It’s ” * ” required but message always is related to specific advert and I just don’t need it on my site.

    Regards,
    Paweł

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    You can remove the Subject field from the Contact Form on Ad details pages by either using Custom Fields extension or by adding the code below in your theme functions.php file

    
    add_filter( "adverts_form_load", function( $form ) {
      if( $form['name'] != "contact" ) {
        return $form;
      }
      foreach( $form["field"] as $key => $field ) {
        if( $field["name"] == "message_subject" ) {
            unset( $form["field"][$key] );
        }
      }
      return $form;
    } );
    

    Note that if you remove the subject field you should probably use the adverts_contact_form_email filter https://github.com/simpliko/wpadverts-snippets/blob/master/contact-form-email/contact-form-email.php or the Emails module to set some custom title in the send message, without the title at all most likely the email will not be sent nor delivered.

Viewing 1 replies (of 1 total)

The topic ‘Delete Subject from Contact Form’ is closed to new replies.