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

Popular posts from this blog

xml - Extract substrings with XSLT -

math - "ELO Rating" and how does "TSR Rating" work? -

How can do a tuple comparison in coffeescript similar to that in python? -