php - Wordpress Core Data Validation Functions not working -
i'm developing custom theme wordpress site , want use wordpress core data validation functions validate info forms.
every time try use sanitize_text_field()
function error:
fatal error: call undefined function sanitize_text_field().
i've read many posts similar issues, specially using $wpdb
, none of them seem work.
the file in i'm trying use sanitation functions inside theme directory, in case piece of info helps solve mystery.
i've seen posts talking including wp-load.php , formatting.php files none of attempts has worked yet.
ok, kept searching , found solution, adding next line of code beginning of file solved problem:
require_once( explode( "wp-content" , __file__ )[0] . "wp-load.php" );
i hope helps else too.
Comments
Post a Comment