title: Automatically removing 'p' tags from the HTML
body: <p>I have the following code, which supposedly removes all <code>p</code> tags that are wrapped around images. I am literally copying and pasting this into my <code>functions.php</code>. However, it's not working:</p>
  
  <pre><code>function filter_ptags_on_images($content){
     return preg_replace('/&lt;p&gt;\s*(&lt;a .*&gt;)?\s*(&lt;img .* \/&gt;)\s*(&lt;\/a&gt;)?\s*&lt;\/p&gt;/iU', '\1\2\3', $content);
  }
  
  add_filter('the_content', 'filter_ptags_on_images');
  </code></pre>
  
  <p>Do I need to change the function parameter with something more relevant to my theme? I'm new to WordPress so apologies for what might seem like a silly question.</p>