Support

Account

Home Forums General Issues Call to undefined function have_rows() in mailer.php Reply To: Call to undefined function have_rows() in mailer.php

  • If you are using mailer.php as the form action, nothing in WP is include there and you will not be able to interact with anything related to WP, plugins or the DB.

    My first suggestion would be to use a form plugin that works with WP instead of working around it. Just so you know, I know where you’re coming from. I used to do the same thing. I don’t know the exact details of what you’re trying to do, so I can’t make any suggestions.

    Another alternative is to have the action to the page the form is on action="" and then include your mailer script on init

    
    add_action('init', 'php_mailer');
    function php_mailer() {
      // test to see if your form is submitted
      // if it is then include mailer.php
      // you might also need to redirect from here, I have not used mailer.php in years
      // not sure what else you would need to do here
    }
    

    If you are using acf_form() to show the form then I would suggest using an acf/pre_save_post filter https://www.advancedcustomfields.com/resources/acf-pre_save_post/ to send your emails and you can do that without needing to use a 3rd party script https://developer.wordpress.org/reference/functions/wp_mail/

    If you are using mailer.php in order to use SMTP there is also a plugin for that https://wordpress.org/plugins/wp-mail-smtp/