use wordpress functions in external php file
snippet in php

use wordpress functions in external php file

user4677

//add to the file that needs to use wordpress functions.
require_once("../../../../wp-load.php");
//or
require_once(rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/wp-load.php');