Take a look at wp_upload_dir
here https://developer.wordpress.org/reference/functions/wp_upload_dir/
$upload_dir = wp_upload_dir();
var_dump( $upload_dir );
/*
$upload_dir will comprise of the following return values:
'path' - (string) Base directory and subdirectory or full path to upload directory.
'url' - (string) Base URL and subdirectory or absolute URL to upload directory.
'subdir' - (string) Subdirectory if uploads use year/month folders option is on.
'basedir' - (string) Path without subdir.
'baseurl' - (string) URL path without subdir.
'error' - (string|false) False or error message.
*/
Related Posts:
- Why doesn’t WP_Image_Editor save images using the Filesystem API?
- Is there a plugin to make attaching images easier?
- Managing Images for a WordPress Blog: Picasa or Flickr?
- Automatically wrap post image in div
- Custom image size not selectable in uploader
- Retrieving and Storing Images Linked from Other Domains on Local Server?
- Customizer image control default value showing in customizer but not on frontend
- Importing media medium setting image gallery / image attachments
- Extract & Display the REAL first image attached to a post – extend the_post_thumbnail()
- Add filename to attachment page url
- How To Add buttons to the toolbar which appears in TinyMce when you click over images
- Image Editor does not affect custom sizes!
- How to display post title & excerpt when mouse hovers on an image?
- Automatically add image caption with values from a post parent field?
- Using Fullscreenr with a wordpress blog – weird bug
- Get Image from Media Library with the Title
- Get Custom Logo Alt Text
- Using custom image resizing script in a page
- Background image not appearing
- Best way to allow overwriting images shipped with the plugin?
- NextGEN Gallery – open all images on page in fancybox [closed]
- Featured Image If Else Condition
- If custom image header does not exist display text header
- Is there a possiblity to replace profile image gravatar with custom user images
- Custom theme – how to link the image without posting it
- Trying to set specific image dimensions and crop with ACF
- Customizing the gallery of the post correctly
- Personalized Gallery what are my options?
- adding fade on mouseover to images
- Lightbox not showing image caption
- WordPress 5: including larger thumbnail image sizes in srcset than I have set
- POST 429 Error when trying to place more than 20 images into post at once
- How to add the option to choose between sizes for featured image within post editor?
- Creating custom setting in add media popup
- Upload image without resizing but insert in post with resizing
- Bio comes up when the visitor clicks on a picture
- Adding images to anchors in the list created and fetched with wp_nav_menu
- Change default “Apply Changes To” radio option when editing images
- WP_Customize_Image_Control and selecting from library?
- featured images – custom links
- Get a different size of Image thumbnail while working with custom metabox
- Custom image sizes ignored in WP 3.5
- Edit image alignment in WordPress twentysixteen child theme on attachment page [closed]
- Set custom banner image size with wp_customize
- How to search for replacement titles and contents, excluding image URLs
- Custom Search on media files PDF images pages posts
- Where are Additional CSS files stored
- What Is The Use Of map_meta_cap Filter?
- Localization: I want the backend: english and frontend in defined language
- Adding an email column to a Custom Post Types Admin Screen?
- Allow Users to Set Password During Registration
- Hide upload image fields for the different media upload popups
- Can I the caption shortcode to set caption to a data attribute, and with the image’s alignment intact?
- Creating Search Engine Friendly URL’s with Word Press
- Extend Screen Options
- How to add “Read More…” link in twentytwenty
- Send a custom WooCommerce email when custom order change [closed]
- Putting tag outside tag on generated Menu
- Advanced Custom Fields: Sorting custom columns with custom fields sorts only by date
- Custom static page get_header error
- How to encode author ID in the author permalink
- Oxygen builder custom Elements
- how do I remove the shipping from woocommerce thankyou page and from the email
- Custom post type adds time/date and author to the post?
- Static admin page for all multisite users
- How to use default WP form elements to interact with custom DB table?
- How can I create a permalink with two categories, with the order based on the parent category?
- How do I add a promotional message to my posts?
- Simplify the admin end
- Creating a shortcode by pulling in a custom field from a plugin
- Divi: how to hide/show specific menu according current page?
- “woocommerce_form_field()” function having issues after latest woocommerce update [closed]
- When should I not use WordPress? [closed]
- Hide Customizer’s Widget Choices From The List
- Custom Post Types database persistance. Why not?
- Customise the Category Widget
- custom user meta query
- Create new network instance, import old single installs AND keep the urls?
- Any Good WordPress Client Like Live Writer To Create Static Pages
- WordPress homepage hangs in IE browsers
- Don’t update modify time post on Quick Edit
- Style WooCommerce Product Search Widget
- Avoid showing the same phrase in the loops
- Why does a custom php code inside a custom template not get executed?
- Wrap WordPress Login Form in custom Div
- Automatically reject a comment if website field contains anything
- Custom permalink structure for posts in certain categories
- Need help with drop down list on the profile
- Hosing a website within a WordPress directory/folder
- Creating a dynamic URL for an external link inside content
- Custom Single Template
- how to auto fille conatct form 7 when user is logined
- How to add H1 Tag on Homepage?
- Display popular posts by how many hits it got within 30 days of publishing
- User registration add user ID?
- Can’t Auto-Update, but permissions are good?
- WordPress uploads directory. Featured Images storage
- Add image custom attribute [closed]
- WooCommerce customise checkout billing form [closed]
- Custom Menu (only showing direct cildren) ACF not showing