• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Tutsplanet

Tutsplanet

Free Technical and Blogging Resources

  • Home
  • Web Hosting
  • Programming
  • Plugins
  • Twitter Trends
  • Tools
  • About Us

Programming TagsWordpress

Get Uploads Directory Path in WordPress

Jun 12, 2018 Editorial Staff Leave a Comment

Share
Tweet
Share

The following code will print the uploads directory path in WordPress

$upload_dir = wp_upload_dir();
print $upload_dir['baseurl'];

It will return the path of WordPress upload directory such as http://yourdomain.com/wp-content/uploads

Basically, this function will print output like below

[path] => /var/www/html/wp-content/uploads/2018/06
[url] => https://yourdomain.com/wp-content/uploads/2018/06
[subdir] => /2018/06
[basedir] => /var/www/html/wp-content/uploads
[baseurl] => https://yourdomain.com/wp-content/uploads
[error] =>

You can write this as a function in your functions.php  to retrieve the uploads directory path.

function tp_wordpress_uploads_directory_path() {
	$upload_dir = wp_upload_dir();
	return $upload_dir['basedir'];
}

Related Posts

  • 7 Best Pagination Plugins For WordPress
  • Pros and Cons of WordPress for Web Designers
  • How To Create A Custom Taxonomy In WordPress
  • How To Send WordPress Email Using SMTP Server
  • How to create a shortcode to display the WordPress site url?
  • WordPress. How to exclude a category and get posts?
  • How to Reduce Post Revisions in WordPress Website?
  • Display All WordPress Posts in One Page with Template Code
  • How to insert inline JavaScript in the footer of your page with WordPress
  • How To Remove Category base From Your URLs In WordPress
  • Adding CSS to WordPress Theme Via functions.php File
  • How to Defer Parsing JavaScript Files in WordPress?
  • 10 WordPress Plugins to Improve Images Performance
  • 6+ WordPress Themes Like Reddit, ProductHunt, & HackerNews
  • Insert a post programatically in WordPress
  • Best selling wordpress premium templates
  • WordPress Hosting
  • How to Exclude a Category from Your WordPress Homepage
  • How to Install WordPress -WordPress Installation Tutorial
  • How to Embed Someone’s Twitter Video in to a Webpage?
  • How To Add Read More Link to Excerpts in Genesis Framework?
  • Top Website Ideas To Make Money Online
  • How to Configure Virtual Host in XAMPP on Windows 10
  • How to Install Let’s Encrypt Certificate on cPanel?
  • Install Apache2, MariaDB, And PHP 7.1 (LAMP) On Ubuntu 16.04 LTS Server
  • How to Add Category or Label Links into Your Menu Bar on Blogger?
  • 6 Best Free Open Source PHP eCommerce Software Solutions
  • The 11 best blogging and publishing platforms on the Internet today
  • How to remove the (yellow) background from AdSense ads?
  • Call to undefined function add_action() in hello.php
  • TimThumb – PHP Image Resizer
  • 10 of best magento extensions you must have in your website

Editorial Staff

Editorial Staff at Tutsplanet is a dedicated team to write various tutorials about subjects like Programming, Technology and Operating Systems.

View all posts by Editorial Staff

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Quick Links

  • Top 21 Website Ideas To Make Money Online in 2021
  • A Simple YouTube Video Downloader Script in PHP
  • The 50 Most Useful jQuery Plugins for Frontend Development
  • Replace “\n” with new line characters, using Notepad++
  • Using Third-Party Libraries in Codeigniter
  • Upload Multiple Images and Store in Database using PHP and MySQL.
  • Hierarchical Tree view Category Example in Laravel
  • Laravel Image Intervention Tutorial With Example
  • How to import sql file in MySQL database using PHP?
  • Free VAT Calculator Online

Subscribe

* indicates required



Search Here

Share

   



Hot topics

  • Replace “\n” with new line characters, using Notepad++ 14 views
  • Solution: windows photo viewer opens each time save a pic file 12 views
  • Simple PHP Shopping Cart 10 views
  • A Simple YouTube Video Downloader Script in PHP 10 views
  • How to Create PDF File From HTML Form Using Fpdf? 9 views
  • All Countries SQL file with Country Codes to Download 8 views
  • How to create and download a Zip file with PHP 8 views
  • How to set up GitHub SSH in Ubuntu with example 7 views
  • How to enter new line in Microsoft Teams? 7 views
  • Hierarchical Tree view Category Example in Laravel 7 views

Categories

  • Design & Development
  • Drupal
  • Facebook
  • General
  • How To
  • ios
  • Javascript
  • Linux
  • Magento
  • Marketing
  • News
  • PHP
  • Plugins
  • Programming
  • Snippets List
  • Social Media
  • Softwares
  • Themes
  • Tips
  • Wordpress
  • YouTube























Copyright © 2023 · Planet on Genesis Framework · Powered By BunnyCDN . Network wallpapernoon.com