Removing frontend dependancies from WordPress Advanced Custom Fields
<p>I'm trying to make my theme totally independent of ACF's <code>get_field</code> and <code>the_field</code> (so in case the plugin is disabled the site will not break). I have an image that is loaded via custom field <code>'slider_image'</code> as an inline <code>background-image</code>. I need to call the URL of the image. Is it possible to load this into inlined html? Here's the working code (w/ ACF's <code>the_field</code>):</p>

<pre><code>    &lt;!-- Hero Image --&gt;
    &lt;section class="hero" style="background: url('&lt;?php the_field('slider_image'); ?&gt;') no-repeat center center; background-size: cover;"&gt;
    &lt;/section&gt;
    &lt;!-- End Hero Image --&gt;
</code></pre>

<p>How can I use <code>get_post_meta</code> to rewrite this statement in case the plugin is disabled?</p>

<p>I've tried: </p>

<pre><code>&lt;section class="hero" style="background: url('&lt;?php echo get_post_meta( get_the_ID(), 'slider_image', true ); ?&gt;') no-repeat center center; background-size: cover;"&gt;
</code></pre>

<p>Which returns:</p>

<pre><code>&lt;section class="hero" style="background: url('98') no-repeat center center; background-size: cover;"&gt;
</code></pre>