I'm writing my first Wordpress plugin and I'm trying to reference the root directory of my plugin. I'm trying to save a PDF file to a folder in my plugin folder. I did some googling and found getcwd() which returned my server path but it took me into the wp-admin folder. I'm trying to find the best way to reference my url.

getwcd() - return /xx/xxx/xxx/mysite.com/wp-admin/

The path that I need to return is /xx/xxx/xxx/mysite.com/wp-content/plugins/my-plugin/<folder-to-save-in> .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.