php - file_exists(...) not working in wordpress -
trying use file_exists()
function in wordpress unable expected result.
if(file_exists(wp_plugin_url.'/sinetiks-schools/images/t_1.jpg')){ echo "ok"; } else { echo "not"; }
you should try:
if(file_exists(plugin_dir_path( __file__ ).'/sinetiks-schools/images/t_1.jpg')){ }
make sure getting correct path plugin_dir_path( __file__ )
you can find more information on plugin_dir_path function here
Comments
Post a Comment