How can I retrieve the path to the root directory in WordPress CMS?
相关问题
- Display product ACF field value in Woocommerce tra
- Adding a custom button after add to cart button in
- How to add a “active” class to a carousel first el
- Setting custom order statuses as valid for payment
- change the font size in tag cloud
相关文章
- wordpress新增页面如何个性化设置
- select query in wordpress
- Get WooCommerce featured products in a WP_Query
- Woocommerce update shipping methods in checkout vi
- Change order status just after payment in WooComme
- Publishing or uploading failed. Error message: “Th
- Facebook Login With WP JWT Auth
- Wordpress development process
Try this function for get root directory path:
You can use get_site_url() function to get the base url of the wordpress site.
For more information, please visit http://codex.wordpress.org/Function_Reference/get_site_url
I think this would do the trick:
If you have WordPress bootstrap loaded you can use
get_home_path()
function to get path to the WordPress root directory.This an old question, but I have a new answer. This single line will return the path inside a template: :)
There are 2 answers for this question Url & directory. Either way, the elegant way would be to define two constants for later use.