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
- Installation échouée : Le téléchargement a échoué. No working transports found
- How to change background color in the Notepad++ text editor?
- How to change or add theme to Android Studio?
- WordPress frameworks and parent themes [closed]
- Custom Post Type Templates from Plugin Folder?
- Opinions and recommendations on the best barebones base theme [closed]
- Remove JSON API links in header html
- Using OOP in themes
- Where can I download WordPress themes from? [closed]
- How can I allow the Editor Role to change Theme Settings?
- What are all the available parameters for query_posts?
- Customizing a WordPress theme without changing it?
- Where can I learn to create my own theme?
- How do I turn off self-closing tags for markup in WordPress (for HTML5, or HTML4, for example)?
- how to add version of style.css in wordpress
- Does WordPress work without a theme?
- What is the role and history of the $content_width global variable?
- Adding admin-ajax.php to the frontend. Good or bad idea?
- How to move the sidebar in TwentyFifteen to the right?
- How to Link External jQuery/Javascript files with WordPress
- Installation failed: Download failed. No working transports found
- What is theme-compat?
- Override parent theme translation on child theme
- WordPress Theme activation hook?
- Link to specific Customizer section
- What does exactly GPL license mean for my WordPress theme?
- Am I allowed to license my WordPress theme under the aGPL
- Getting Images from theme’s directory in pages
- How do I change the header image height in Twenty Seventeen?
- Starter Theme vs Parent Theme? Pros and cons
- How to change the language for the front-end only?
- W3 Total Cache, CDN and theme files [closed]
- How to move page template files like page-{slug}.php to a sub-directory?
- Best way to include Bootstrap in WordPress
- How to set thumbnail image for a (child) theme
- Different template of products for specific category. WooCommerce
- Show different theme for admin?
- How can I create a bash install script for my WordPress sites setup (WP+plugins+theme)?
- How can I version the main CSS file?
- what the best way to include images from the template’s images folder?
- Is it OK to remove theme credits from footer? [duplicate]
- Undefined offset: 0 in > […] /wp-includes/capabilities.php on line 1067
- How can I get the title attribute from get_the_post_thumbnail()?
- No “Add New” Button. How to add new theme?
- How do I add support to my theme for custom menus?
- “Unexpected error” on update requests
- How do I white label my self-hosted site created by wordpress?
- Do Child-Themes automatically load the Translation from the Parent-Theme?
- When cropping a header image, retain meta data (i.e. name, description, etc.) from original image?
- Best practices for a Style/CSS based theme options page?
- What WP folder can I use to write files to?
- How to create a new theme from scratch?
- Switching themes without losing widgets?
- How to use media upload on theme option page?
- Dynamic template serving, change theme_root using add_filter from current theme
- What theme is good for posting code? [closed]
- WordPress 5 / Gutenberg – theme doesn’t have featured image option showing up
- Custom Taxonomy-specific JavaScript
- How to refresh WordPress Customizer panel upon entering a value
- Set Featured Image for Archive templates
- is_front_page only works in theme file, and does not work in functions.php
- What is meant by __(‘page’,’twentytwelve’)
- How do I add a new string to a .po or .pot file?
- Adding Language Support using .pot and .mo files to a WordPress Theme?
- Difference between stylesheet_directory and template_directory
- Free/Open-Source Theme Frameworks as an Alternate to Thesis? [closed]
- can require “themefolder/includes/widgets.php” in “themefolder/functions.php” yet widgets.php doesn’t run