<p>Have you tried setting Redactor's <code>paragraphize</code> setting to <code>false</code> for your Rich Text field?</p>

<p><a href="http://imperavi.com/redactor/docs/settings/clean/#setting-paragraphize" rel="nofollow">http://imperavi.com/redactor/docs/settings/clean/#setting-paragraphize</a></p>

CC BY-SA 3.0
2015-07-08T19:20:39.523Z
2015-07-08T19:20:39.523Z
Arms
<p>I wrote <a href="https://github.com/mmikkel/RetconHTML-Craft" rel="nofollow noreferrer">a plugin called Retcon</a> which uses <a href="http://php.net/manual/en/class.domdocument.php" rel="nofollow noreferrer">DOMDocument</a> to rewrite HTML content.</p>

<p>Here's how you could unwrap your images using the <a href="https://github.com/mmikkel/RetconHTML-Craft/wiki/Unwrap" rel="nofollow noreferrer">retconUnwrap</a> filter in a template:</p>

<pre><code>{{ entry.body|retconUnwrap('img') }} 
</code></pre>

<p>(Of course, this won't actually remove the <code>&lt;p&gt;</code> tags in your content; it'll only strip them out when that content is rendered.)</p>

CC BY-SA 3.0
2016-11-04T00:06:43.337Z
2016-11-04T00:06:43.337Z
Mats Mikkel Rummelhoff
<p>I’m not sure that this is possible – Redactor has some checks in its code to make sure everything lives within a block-level element like <code>&lt;p&gt;</code>.</p>

<p>You might be better off using a Matrix field instead, with Text and Image block types. You can still use a Redactor field within your Text block type; just disable the Image toolbar button on it from your Redactor config in craft/config/redactor/. Give the Image block type an actual Assets field.</p>

<p>Then from your templates you’ll have full control over the image markup.</p>

<pre><code>{% for block in entry.myMatrixField %}

    {% if block.type == 'text' %}

        {{ block.myRichTextField }}

    {% elseif block.type == 'image' %}

        {% set image = block.myAssetsField.first() %}
        {% if image %}
            &lt;img src="{{ image.url }}" width="{{ image.width }}" height="{{ image.height }}" alt="{{ image.title }}"&gt;
        {% endif %}

    {% endif %}

{% endfor %}
</code></pre>

CC BY-SA 3.0
2014-07-11T20:05:40.407Z
2014-07-11T20:05:40.407Z
Brandon Kelly
<p>I'm looking to have the <code>&lt;img&gt;</code> inserted without the wrapping <code>&lt;p /&gt;</code>. I'm assuming I can tie in to one of the callback functions to do this? There is a <code>fileUploadCallback</code> function available but based on nomenclature, doesn't seem like that would help me if I added a path to a remote image versus uploading one.</p>

<p>Has anyone done this yet?</p>

<entries><richtext><redactor>
How do I prevent Redactor from wrapping <img> with <p />
# How do I prevent Redactor from wrapping <img> with <p />

(Asked by: username_0 on 2014-07-11)

I'm looking to have the `![]()` inserted without the wrapping . I'm assuming I can tie in to one of the callback functions to do this? There is a `fileUploadCallback` function available but based on nomenclature, doesn't seem like that would help me if I added a path to a remote image versus uploading one.

Has anyone done this yet?

**Tags:** entries, richtext, redactor

---

## 3 answers

### Answer by username_3 on 2014-07-11. Score: 4 | Accepted answer

I’m not sure that this is possible – Redactor has some checks in its code to make sure everything lives within a block-level element like .
You might be better off using a Matrix field instead, with Text and Image block types. You can still use a Redactor field within your Text block type; just disable the Image toolbar button on it from your Redactor config in craft/config/redactor/. Give the Image block type an actual Assets field.
Then from your templates you’ll have full control over the image markup.
{% for block in entry.myMatrixField %}

    {% if block.type == 'text' %}

        {{ block.myRichTextField }}

    {% elseif block.type == 'image' %}

        {% set image = block.myAssetsField.first() %}
        {% if image %}
            
        {% endif %}

    {% endif %}

{% endfor %}


---

### Answer by username_1 on 2015-07-08. Score: 2

Have you tried setting Redactor's `paragraphize` setting to `false` for your Rich Text field?

<http://imperavi.com/redactor/docs/settings/clean/#setting-paragraphize>


---

### Answer by username_2 on 2016-11-04. Score: 2

I wrote a plugin called Retcon which uses DOMDocument to rewrite HTML content.
Here's how you could unwrap your images using the retconUnwrap filter in a template:
{{ entry.body|retconUnwrap('img') }} 

(Of course, this won't actually remove the  tags in your content; it'll only strip them out when that content is rendered.)


---

