• PHP Fatal error: Uncaught Error: Call to undefined function sanitize_text_field() in /home/[redacted]/public_html/wp-content/plugins/seamless-donations/pay/paypalstd/ipn.php:15

    <?php
    /*
     * Seamless Donations by David Gewirtz, adopted from Allen Snook
     *
     * Lab Notes: https://zatzlabs.com/lab-notes/
     * Plugin Page: https://zatzlabs.com/seamless-donations/
     * Contact: https://zatzlabs.com/contact-us/
     *
     * Copyright (c) 2015-2022 by David Gewirtz
     *
     */
    // https://seamlessdonations.local/wp-content/plugins/seamless-donations/pay/paypalstd/try.php
    
    // derive server URL without touching WordPress at all
    $the_domain = sanitize_text_field( $_SERVER['HTTP_HOST'] );
    $https  = sanitize_text_field( $_SERVER['HTTPS'] );
    if ( strtolower( $https ) == 'on' ) {
    	$url = 'https://' . $the_domain . '?PAYPALIPN=1';
    } else {
    	$url = 'https://' . $the_domain . '?PAYPALIPN=1';
    }
    
    header( 'Location: ' . $url );
    exit;

    The comment indicates that we want to do this without the assistance of WordPress but sanitize_text_field() is a WordPress function. As a quick fix to get this working, I am including wp-load.php to get the missing function. To get this to work without WordPress, you’ll have to choose a different function.

  • The topic ‘undefined function sanitize_text_field()’ is closed to new replies.