1import{b as _,t as k}from"./DYlqQAKM.js";import"./PbBaDgI_.js";import{X as n,$ as g,Y as e,Z as o}from"./Cc7_iAaH.js";import{h as p}from"./B-63aLme.js";import{l as f,s as m}from"./DZiJuw4t.js";import{L as $}from"./BZLVUxjg.js";const r={title:"Get Uploads Directory Path in WordPress",date:"2017-04-21T19:49:22.121Z"};var y=k('<p>The following function can be used to get the absolute path to the WordPress uploads directory:</p> <pre class="language-php"><!></pre> <p>It will return a path to where the WordPress <code>/uploads/</code> directory is, whether itâs in the default location or whether an <code>UPLOADS</code> constant has been defined to specify an alternate location. The path it returns will look something like:</p> <pre class="language-sh"><!></pre>',1);function b(l,c){const i=f(c,["children","$$slots","$$events","$$legacy"]);$(l,m(()=>i,r,{children:(u,w)=>{var a=y(),s=n(g(a),2),d=e(s);p(d,()=>`<code class="language-php"><span class="token comment">/** 2 * Get the absolute path to the WordPress uploads directory, 3 * with a trailing slash. 4 * 5 * @return string The uploads directory path. 6 */</span> 7<span class="token keyword">function</span> <span class="token function-definition function">km_get_wordpress_uploads_directory_path</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> 8 <span class="token variable">$upload_dir</span> <span class="token operator">=</span> <span class="token function">wp_upload_dir</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> 9 10 <span class="token keyword">return</span> <span class="token function">trailingslashit</span><span class="token punctuation">(</span> <span class="token variable">$upload_dir</span><span class="token punctuation">[</span><span class="token string single-quoted-string">'basedir'</span><span class="token punctuation">]</span> <span class="token punctuation">)</span><span class="token punctuation">;</span> 11<span class="token punctuation">}</span></code>`),o(s);var t=n(s,4),h=e(t);p(h,()=>'<code class="language-sh">/path/to/wordpress/wp-content/uploads/</code>'),o(t),_(u,a)},$$slots:{default:!0}}))}const S=Object.freeze(Object.defineProperty({__proto__:null,default:b,metadata:r},Symbol.toStringTag,{value:"Module"}));export{S as _,b as a};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.