dots Created with Sketch.
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
?>


amazon

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

#Jul 22 Is there a CSS parent selector? #Jul 22 Difference between :where and :is in CSS #Jul 22 Does :is() pseudo selector hint at CSS preprocessing in the future? #Jul 22 Control Scrolling with CSS Scroll Snap #Jul 21 Control rendering using CSS content-visibility property #Jul 21 How to use @supports rule in CSS?
You might also like these
Can We Use For Loop to Loop Through Associative Arrays in PHP?PHPHow to add today’s date in HTML input date value using JavaScript?JavaScripttransform-origin Property in CSSCSSCustom Post Type Template Files in WordPressWordPressHow to convert a number rounding to a specified number of decimals in JavaScript?JavaScriptHow to retrieve homepage URL in WordPress?WordPressHow to Create a Backup From Any Database in SQL?SQL/MySQLLearn how to give a temporary name to a column or to a table using SQL AliasesSQL/MySQLHow to add a Bar Chart in Angular App?AngularHow to add AppRoutingModule in Angular application using command line?AngularEssential SQL Commands We Need to KnowSQL/MySQLWordPress: How to print ACF repeater field values?WordPress