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
- Adding admin-ajax.php to the frontend. Good or bad idea?
- How do I add support to my theme for custom menus?
- How do I white label my self-hosted site created by wordpress?
- How do I add a new string to a .po or .pot file?
- 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
- Permalink Issues by Installing WordPress in Subdirectory / Subfolder
- Multisite: setting theme and options when a new blog is created
- How to use scss in wordpress theme?
- How to get Ajax into a theme – without writing a plugin?
- WordPress as Backend, Laravel Front End: How to connect Routes?
- How to get themes from wordpress.com per SVN? [closed]
- Edit raw HTML of the landing page
- single.php change into a modal popup bootstrap wordpress
- get_header(‘header2’) not working properly in child themes
- How do you create a custom WPTouch theme?
- Added a new template file to a theme – get Call to undefined function error
- Theme broken after upgrading to WordPress 4.5, missing stylesheet?
- WordPress Theme for Video Showcase [closed]
- Do not show excerpt in post content
- Widgets menu does not appear under “Appearance” in dashboard
- Calling widget via function in themes files (hard code)
- What’s the order of loading wordpress elements?
- How to add pagination to my code?
- Creating new templates in child themes breaks layout
- Child theme not working after Parent Theme Update
- Combining wordpress themes
- how to use the slide show of Skylark in showcase?
- Switching to a child theme
- CSS Start Fresh option on; main.css still being loaded [closed]
- When creating a WordPress site how can you create different versions of the site with different themes?
- after_setup_theme is called three times
- Losing all my text and entries on ColorWay Theme
- Functions containing parameter ‘yourtheme’
- How do I remove ‘Active Theme’ section from Customizer?
- Cant remove white space on my wordpress [closed]
- Blank line before doctype
- To perform the requested action, WordPress needs to access your web > server
- WordPress Baskerville 2 translation
- .PO file is found but I don’t see translations: how to debug the problem?
- An unexpected error occurred when add theme
- Posts & page twice display
- How to get ONLY the URL of the image that show_media_header returns?
- Create Custom Attachment Template That is Processed from Plugin Folder?
- How to include stylesheet in custom admin using parent_slug
- How would I got about calling a php file every time someone publishes a new post?
- Custom theme – pages in menu
- remove preloader in WordPress theme [closed]
- Flexslider in child theme
- Why my function.php file in theme delete automatically? [closed]
- How to reverse the pagination numbers of an archive?
- Theme translates the_author_posts_link. How can I remove their translation?
- Theme CSS missing completely
- How to implement this layout?
- WordPress customizer extremely slow, cant work in it
- Missing privacy policy checkbox on login page (using Enfold theme)
- How exactly does WordPress load themes from api.wordpress.org?
- Themes don’t show up in the dashboard -> Appearance -> Themes
- Let custom text widget use the same font as the theme
- SSL errors when I activate my custom theme
- How to show taxonomy in WordPress shortcode
- Create a live demo gallery for themes
- No “available widgets” (wordpress 3.2.1 multisite)
- How to create a second index.php?
- Lightword Theme – only one menu item
- How to create an Single-Portfolio page?
- “Parse error: syntax error, unexpected” and the WordPress Theme Editor no longer working!