The WordPress directory path is available in the constant ABSPATH. Be aware this is not related to the wp-content directory. The constant WP_CONTENT_DIR could be set to exactly the same value. Or another directory on the same level where WP_CONTENT_URL is another domain name.
There doesn’t even have to be a wp-content equivalent: themes, plugins, languages and so on might be spread over different directories.
Do not rely on default paths.
define('symbiostock_STOCKDIR', $_SERVER['DOCUMENT_ROOT'] . '/symbiostock_rf/' );
This will break in many setups. Use get_template_directory_uri() instead, and let WordPress figure out where that is.
Another word on constants: avoid them. There might be collisions with other people’s code. They are slow. Use a helper function to load classes instead, and solve all path problem in that function’s body, not in the global namespace.
Related Posts:
- wp theme.. Could not create directory
- Can wordpress theme folder name be changed freely and nothing technically happens
- Dash or underscore in theme folder name?
- How to prevent plugin, theme installation failures on WordPress?
- Categorising themes by folders in backend
- How do i structure my theme folder to avoid one huge list of files
- Migrating October CMS to WordPress
- get_template_directory has an odd functionality
- During theme installation theme upload failed
- Custom theme folder
- WordPress not displaying themes in the wp-content/themes folder
- Installed theme uses get_template_directory, breaks WordPress on Windows
- How prevent someone from opening my theme directory
- How to run WordPress from other location on the same domain
- WordPress root directory change + Theme directory change
- Permissions for installing themes and files in general?
- Configure new installed WordPress in live server
- Installing a theme on localhost, Ubuntu 16.04
- Conditional config WP_HOME/WP_SITEURL does not update bloginfo(‘template_url’)?
- Create QuickStart Package for WordPress just like in Joomla
- Error when installing theme – “failed to open stream: No such file or directory in…”
- How can i set default pages to a word press theme? it shouldn’t be changed even if i install the theme in different host
- Customized wordpress theme locally put on someones WordPress account
- WP-CLI wp theme install url PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature
- How do I get the path to the currently in use theme’s directory?
- Unable to access new installed theme
- Orion theme (from theme forest) [closed]
- How do I block a subdirectory from WordPress theming?
- Categorising themes by folders in backend
- I can’t install theme: theme install failed
- hardened wordpress linux install
- How are my own themes updated?
- Theme install failed
- Override parent theme translation on child theme
- What does exactly GPL license mean for my WordPress theme?
- What WP folder can I use to write files to?
- How to incorporate admin theme in my back-end-plugin
- Using chunk theme from wordpress.com on my own host
- What is the first file wordpress looks at in a theme?
- Duplicate and change a Theme Widget
- Two Navigation Menus in Themes Produce the same menus?
- Theme not showing after uploading
- Being asked to update a theme that I don’t have
- I want to run different WordPress websites under the same database
- get_template_directory_uri does not seem to work when defining WP_CONTENT_DIR
- Using a _GET gives me a debug error (over my head)
- Possible to put header-{your_custom_template}.php in subdirectory?
- Why wp_enqueue_style() not working?
- 404 Error while accessing the font files
- Child Style.css not overriding parent theme style located in assets/css/main.css
- Creating a theme options page
- OptimizePress Theme Overriding add_filter page_template
- How do I change the scan depth for page template files?
- Moving test theme to live site without mySQL error – how? [closed]
- Correct folder permissions?
- Apache errors when retrieving taxonomies
- wp_get_theme() works fine, but wp_get_themes() returns empty array
- Read More Button Not Responding To Click
- Can’t resize logo in responsive theme?
- translation does not work for ‘Home’
- Function that outputs second theme url
- Is that a malicious code?
- Where do I find (free) fully-internationalized themes? [closed]
- How do I manually revert back to my old theme?
- Modifying the markup in the Tag Cloud widget?
- How to trace and resolve a theme problem such as flickering links in WordPress? [closed]
- Child theme looks different from parent theme, and incorrectly displays parts
- Adding an extra sidebar to your theme
- Widgets not showing on sidebars
- linking to an svg through comments_popup_link
- How to use custom page templates in a theme that hides page template option?
- How can I add text on top of slideshow? [closed]
- Display Headings on Index page in different font sizes
- Fix threaded comments
- Using DePo Masthead with WP 3+
- How to get this taxonomy name from wp_get_object_terms()?
- Load elements without reload page [closed]
- Any way that guest users see the site as registered users?
- Child theme not activating despite success message
- Webflow Interactions on WordPress site?
- After changed url from http to https, it says “This site can’t be reached”
- WordPress 404 on style.css but not on all pages
- Is a dynamic website with lots of urls possible with wordpress [closed]
- Edit box-header on WordPress Dashboard
- Is there significant risk in not keeping a theme updated? [closed]
- Sticky header for wordpress changes size and logo size as I scroll down
- How to assign a Category to a Page, when both are created on theme initiation?
- Copy from wordpress for dev gives different output in browser
- When translating not all string are present in POedit
- How to retrieve images attached to post through media library?
- How to fetch the no. of Users dynamically?
- Create a child Theme or custom Theme
- Capcha not getting displayed
- Starting fresh on a blank “theme” [closed]
- Mystique theme: widgets on sidebar falling under the page content
- My theme switches to “Twenty twenty two” on its own even if deleted
- Check if style is declared in child theme from within parent theme. if so, use that style in parent theme
- Homepage not loading correctly, only after refreshing
- How do I create a post / page without needing get_header() and get_footer()?
- How to cancel style.min.css file?