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 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#Aug 15 Is PHP still good for back-end programming? #Aug 10 How to create a multisite network in WordPress? #Aug 3 How to create a circle that follows a cursor using JavaScript and CSS? #Aug 3 How to make a curtain slider using jQuery and CSS? #Aug 2 How to progressively load images and add a blurry placeholder? #Aug 1 How to create a placeholder loader (throbber) using CSS?
You might also like these
Introduction to components and templates Part 4: Pipes and DirectivesAngularHow to Remove PHP File Extensions From Your Website URLs?PHPHow to calculate elapsed time in JavaScript?JavaScriptIntroduction to Angular modules Part 1: NgModule metadataAngularHow to Use the EXISTS and NOT EXISTS Operator with a Subquery in SQL and MySQL?SQL/MySQLWordPress get_posts ExamplesWordPressThe Lending Club Analysis using Logistic Regression and Random Forest in RStudioMiscellaneousWhat is IPS(Intrusion Prevention System), How Does It Work and What are the Detection Types?MiscellaneousWhat are Identifiers in JavaScript?JavaScriptWordPress: How to get field values in Advanced Custom Fields?WordPressHow to create a flip pricing table using CSS and JavaScript?CSSSelf-Driving and Intelligent NetworksMiscellaneous