Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Avoid native php functions</h2> <ol> <li>They are not relative, so breaking stuff is easy. (like in the OPs case)</li> <li>Why role your own if core got a function for you?</li> <li>They don't consider edge cases</li> </ol> <p>You should NEVER use the constants</p> <ul> <li><code>STYLESHEET_DIRECTORY</code></li> <li><code>TEMPLATE_DIRECTORY</code></li> <li><code>WP_PLUGIN_DIR</code></li> <li>etc...</li> </ul> <p><sup>Remember: Those are <em>not</em> API! and can therefore change!</sup></p> <p><em>but</em> INSTEAD USE the following API functions:</p> <ul> <li>Parent Theme: <code>get_template_directory()</code> / <code>get_template_directory_uri()</code></li> <li>Child Theme: <code>get_stylesheet_directory()</code> / <code>get_stylesheet_directory_uri()</code></li> </ul> <p>You can use both in Plugins</p> <ul> <li><code>plugin_dir_path(__FILE__).'/your/path/to/file.ext</code> <sup>*) for Themes also</sup></li> <li><code>plugin_dir_url( __FILE__ ).'/your/path/to/file.ext</code> </li> </ul> <p>but <code>plugin_dir_url()</code> is reserved only for Plugins.</p> <h2>Keep in mind...</h2> <p>That there're</p> <ul> <li>Plugins</li> <li>MU-Plugins</li> <li>Drop-Ins</li> <li>Themes</li> <li>Themes in directories registered via <code>register_theme_directory( $dir );</code></li> </ul> <p>So please stick with the native API functions like <code>wp_upload_dir();</code>, <code>content_url();</code>, etc.</p> <p>In general: Take a look at <code>/wp-includes/link-template.php</code> for a whole bunch of nice path and URl related API functions.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload