Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#29582 closed feature request (invalid)

Home Folder variable

Reported by: selnomeria's profile selnomeria Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0
Component: General Keywords:
Focuses: Cc:

Description

Hello. It's so many times, wordpress doesnt have this feature. I mean, in WP_OPTIONS, there is 'home_url' variable (i.e. http://mysite.com/wp_dir/ ), but there doesnt exist 'home_folder' variable ( /wp_dir/ ), and it is very good, if you add this one variable into wp_options, as i have always to manually use a code to get my home directory (i.e. for onsite image/file embedds i use <img src="/wp_dir/myfile.png">)

so, give us a feature to get wp installed home diretory.

Change History (7)

#1 @SergeyBiryukov
9 years ago

There is ABSPATH constant defined in wp-config.php: tags/4.0/wp-config-sample.php#L75.

#2 @nacin
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

ABSPATH is actually defined in wp-load.php, and is left at the bottom of wp-config.php for backwards compatibility. If you have nothing (like a plugin) directly including wp-config.php, you can safely remove it.

selnomeria, I can't quite make out what you are trying to do, but I have enough confidence to think that I'm 99% sure it's doable already. Please try the support forums: http://wordpress.org/support/.

#3 @selnomeria
9 years ago

havent you read my question?
Why have you mentioned abspath? its too much different thing, then i have requested.
ABSPATH is for php , to include file i.e. home/mysite/public_html/wp_dir/something_file.php

and i want to get path for browsers, starting only with WP installed directory (maybe root, or maybe subfolder. if subfolder wp_dir, then i want:
<img src="/wp_dir/something_file.png" />

#4 @SergeyBiryukov
9 years ago

OK, use home_url() or get_stylesheet_directory_uri().

Looks like you want a relative path instead of the full URL (why?), use home_url( '/', 'relative' ) in that case.

#5 @selnomeria
9 years ago

WHY??
100% of local files and images and script need that path, and not abspath.
are not you programmers? I am surprised so much, havent you ever viewed the website sources with
<img src="/wp_dir/wp-content/uploads......" />
instead of
<img src="http://mysite.com/wp_dir/wp-content/uploads......" />

and according to you, if i use ABSPATH,browser will get:
<img src="home/mysite/public_html/wp_dir/wp-content/uploads......" />

so, the simplest solution is to add just home folder path too in wp_options.

i always (and professional programmers), use the first type of urls.

#6 @SergeyBiryukov
9 years ago

Please ignore the ABSPATH reference, I misread the ticket initially.

Most of the time, it's actually easier to use absolute URLs for local development, however that depends on your environment and workflow (there were some long discussions in older tickets, and I don't want to start another one).

What's wrong with home_url( '/', 'relative' )?

#7 @selnomeria
9 years ago

and whats wrong, if WORDPRESS has defined 1 more value in wp_options table after the WP insallation...
because not all people know

home_url( '/', 'relative' )

as it is not easily rememberable to type frequently while coding the website.

EVEN, not a value in wp_options, but at least, it was good if there was constant, like ABSFOLDER??

good idea i think!

Note: See TracTickets for help on using tickets.