Path address in React Plugin code
-
I am writing a WordPress plugin (using React, JSX) that uses images so if I write out the html it’ll look like below, however would the folder structure always be the same?
<img src="../wp-content/plugins/my_plugin/images/an_image.png" alt="picture" />Because I’m expecting there to be a wp-content folder and a plugins folder, if I hard code these values could things go wrong?
I know if I do things with php I can use the
dirname(plugin_basename(FILE))function but what should I be doing? And why?I’m new at this react and I can seen to get the value from the
dirname(plugin_basename(FILE))function to the html.
The topic ‘Path address in React Plugin code’ is closed to new replies.