WordPress Plugin: Determining the Plugin Path
Often you need to determine fi le and folder paths within your plugins. For example, you might have an image in your plugin folder that you want to display. Generally speaking, it isn ’ t a good idea to hardcode a directory path in a plugin. WordPress can be confi gured to run in a million different ways, so assuming you know the proper directory paths is a mistake. This section looks at the proper way to determine fi le and folder paths in your WordPress plugin.
A common task in any plugin is referencing fi les and folders in your WordPress installation. You can reference fi les in your code in two ways: using the local server path or by using a standard URL. (more…)