Yogesh Chauhan's Blog

List of WordPress directories functions

in WordPress on June 15, 2021

Here’s the list of functions that are helpful to get directories path in WordPress. You can use it while developing a theme or even creating a plugin.

WordPress Directories Functions

Get Home URL


<?php 
  echo home_url();
  https://www.yogeshchauhan.com
?>


Get Site directory URL


<?php 
  echo site_url();
  http://www.yogeshchauhan.com or 
  http://www.yogeshchauhan.com/wordpress
?>


Get Admin directory URL


<?php 
  echo admin_url();
  http://www.yogeshchauhan.com/wp-admin
?>


Get Includes directory URL


<?php 
  echo includes_url();
  http://www.yogeshchauhan.com/wp-includes
?>


Get Content directory URL


<?php 
  echo content_url();
  http://www.yogeshchauhan.com/wp-content
?>


Get Plugins directory URL


<?php 
  echo plugins_url();
  http://www.example.com/wp-content/plugins
?>


Get Upload directory URL (an array)


<?php 
  echo wp_upload_dir();
  http://www.example.com/wp-content/uploads
?>



Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #4 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #5 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
How to remove special characters (dash, asterisk etc) from any string in PHP?PHPKilling A Project Part 4: What Would Be Your Top 3 Priorities For Planning The Cancellation?MiscellaneousHow to make flexbox items of the same size?CSSJavaScript String fromCharCode() MethodJavaScriptHow to reprocess failed items in Etrieve Flow?MiscellaneousWhat is the difference between let and var in Swift?SwiftWhat happens when we add Numbers and Strings in JavaScript?JavaScriptHow to Write Complex Search Queries in SQL?SQL/MySQLSQL Right JoinSQL/MySQL3 JavaScript methods to use when you want to go back and forth in historyJavaScriptA Quick Guide to Object-Oriented Programming in PHPPHPHow to get previous days or next days in PHP?PHP