Quicktag auto inserted into first foreach loop item

Previously I used wp_editor but decided to stop doing that and use a plain textarea field instead.

I’m using a foreach loop, and in the first row of the loop WordPress auto inserts the quicktag toolbar and adds display:none to my textarea.

This is the first item in the loop:

<form action="" method="post">
                                        <input type="hidden" name="todo" id="todo" value="add_message">
                                        <input type="hidden" name="order_id" id="order_id" value="2891">
                                        <div id="qt_message_content_toolbar" class="quicktags-toolbar"><input type="button" id="qt_message_content_strong" class="ed_button button button-small" aria-label="Bold" value="b"><input type="button" id="qt_message_content_em" class="ed_button button button-small" aria-label="Italic" value="i"><input type="button" id="qt_message_content_link" class="ed_button button button-small" aria-label="Insert link" value="link"><input type="button" id="qt_message_content_block" class="ed_button button button-small" aria-label="Blockquote" value="b-quote"><input type="button" id="qt_message_content_del" class="ed_button button button-small" aria-label="Deleted text (strikethrough)" value="del"><input type="button" id="qt_message_content_ins" class="ed_button button button-small" aria-label="Inserted text" value="ins"><input type="button" id="qt_message_content_img" class="ed_button button button-small" aria-label="Insert image" value="img"><input type="button" id="qt_message_content_ul" class="ed_button button button-small" aria-label="Bulleted list" value="ul"><input type="button" id="qt_message_content_ol" class="ed_button button button-small" aria-label="Numbered list" value="ol"><input type="button" id="qt_message_content_li" class="ed_button button button-small" aria-label="List item" value="li"><input type="button" id="qt_message_content_code" class="ed_button button button-small" aria-label="Code" value="code"><input type="button" id="qt_message_content_more" class="ed_button button button-small" aria-label="Insert Read More tag" value="more"><input type="button" id="qt_message_content_close" class="ed_button button button-small" title="Close all open tags" value="close tags"></div><div id="mceu_25" class="mce-tinymce mce-container mce-panel" hidefocus="1" tabindex="-1" role="application" style="visibility: hidden; border-width: 1px;"><div id="mceu_25-body" class="mce-container-body mce-stack-layout"><div id="mceu_26" class="mce-toolbar-grp mce-container mce-panel mce-stack-layout-item mce-first" hidefocus="1" tabindex="-1" role="group"><div id="mceu_26-body" class="mce-container-body mce-stack-layout"><div id="mceu_27" class="mce-container mce-toolbar mce-stack-layout-item mce-first" role="toolbar"><div id="mceu_27-body" class="mce-container-body mce-flow-layout"><div id="mceu_28" class="mce-container mce-flow-layout-item mce-first mce-last mce-btn-group" role="group"><div id="mceu_28-body"><div id="mceu_0" class="mce-widget mce-btn mce-menubtn mce-fixed-width mce-listbox mce-first mce-btn-has-text" tabindex="-1" aria-labelledby="mceu_0" role="button" aria-haspopup="true"><button id="mceu_0-open" role="presentation" type="button" tabindex="-1"><span class="mce-txt">Paragraph</span> <i class="mce-caret"></i></button></div><div id="mceu_1" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_1" role="button" aria-label="Bold"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-bold"></i></button></div><div id="mceu_2" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_2" role="button" aria-label="Italic"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-italic"></i></button></div><div id="mceu_3" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_3" role="button" aria-label="Bulleted list"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-bullist"></i></button></div><div id="mceu_4" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_4" role="button" aria-label="Numbered list"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-numlist"></i></button></div><div id="mceu_5" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_5" role="button" aria-label="Blockquote"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-blockquote"></i></button></div><div id="mceu_6" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_6" role="button" aria-label="Align left"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-alignleft"></i></button></div><div id="mceu_7" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_7" role="button" aria-label="Align center"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-aligncenter"></i></button></div><div id="mceu_8" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_8" role="button" aria-label="Align right"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-alignright"></i></button></div><div id="mceu_9" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_9" role="button" aria-label="Insert/edit link"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-link"></i></button></div><div id="mceu_10" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_10" role="button" aria-label="Remove link"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-unlink"></i></button></div><div id="mceu_11" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_11" role="button" aria-label="Insert Read More tag"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-wp_more"></i></button></div><div id="mceu_12" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_12" role="button" aria-label="Fullscreen"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-fullscreen"></i></button></div><div id="mceu_13" class="mce-widget mce-btn mce-last" tabindex="-1" aria-labelledby="mceu_13" role="button" aria-label="Toolbar Toggle"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-wp_adv"></i></button></div></div></div></div></div><div id="mceu_29" class="mce-container mce-toolbar mce-stack-layout-item mce-last" role="toolbar" style="display: none;"><div id="mceu_29-body" class="mce-container-body mce-flow-layout"><div id="mceu_30" class="mce-container mce-flow-layout-item mce-first mce-last mce-btn-group" role="group"><div id="mceu_30-body"><div id="mceu_14" class="mce-widget mce-btn mce-first" tabindex="-1" aria-labelledby="mceu_14" role="button" aria-label="Strikethrough"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-strikethrough"></i></button></div><div id="mceu_15" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_15" role="button" aria-label="Horizontal line"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-hr"></i></button></div><div id="mceu_16" class="mce-widget mce-btn mce-colorbutton" role="button" tabindex="-1" aria-haspopup="true" aria-label="Text color"><button role="presentation" hidefocus="1" type="button" tabindex="-1"><i class="mce-ico mce-i-forecolor"></i><span id="mceu_16-preview" class="mce-preview"></span></button><button type="button" class="mce-open" hidefocus="1" tabindex="-1"> <i class="mce-caret"></i></button></div><div id="mceu_17" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_17" role="button" aria-label="Paste as text"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-pastetext"></i></button></div><div id="mceu_18" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_18" role="button" aria-label="Clear formatting"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-removeformat"></i></button></div><div id="mceu_19" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_19" role="button" aria-label="Special character"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-charmap"></i></button></div><div id="mceu_20" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_20" role="button" aria-label="Decrease indent"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-outdent"></i></button></div><div id="mceu_21" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_21" role="button" aria-label="Increase indent"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-indent"></i></button></div><div id="mceu_22" class="mce-widget mce-btn mce-disabled" tabindex="-1" aria-labelledby="mceu_22" role="button" aria-label="Undo" aria-disabled="true"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-undo"></i></button></div><div id="mceu_23" class="mce-widget mce-btn mce-disabled" tabindex="-1" aria-labelledby="mceu_23" role="button" aria-label="Redo" aria-disabled="true"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-redo"></i></button></div><div id="mceu_24" class="mce-widget mce-btn mce-last" tabindex="-1" aria-labelledby="mceu_24" role="button" aria-label="Keyboard Shortcuts"><button role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-wp_help"></i></button></div></div></div></div></div></div></div><div id="mceu_31" class="mce-edit-area mce-container mce-panel mce-stack-layout-item" hidefocus="1" tabindex="-1" role="group" style="border-width: 1px 0px 0px;"><iframe id="message_content_ifr" frameborder="0" allowtransparency="true" title="Rich Text Area. Press Alt-Shift-H for help." src='javascript:""' style="width: 100%; height: 100px; display: block;"></iframe></div><div id="mceu_32" class="mce-statusbar mce-container mce-panel mce-stack-layout-item mce-last" hidefocus="1" tabindex="-1" role="group" style="border-width: 1px 0px 0px;"><div id="mceu_32-body" class="mce-container-body mce-flow-layout"><div id="mceu_33" class="mce-path mce-flow-layout-item mce-first"><div role="button" class="mce-path-item mce-last" data-index="0" tabindex="-1" id="mceu_33-0" aria-level="1">p</div></div><div id="mceu_34" class="mce-flow-layout-item mce-last mce-resizehandle"><i class="mce-ico mce-i-resize"></i></div></div></div></div></div>
                                        <textarea class="whatever" name="message_content" id="message_content" placeholder="Enter your comment here" aria-hidden="true" style="display: none;"></textarea>
                                        <input type="submit" name="" value="Submit" style="margin-top:15px;"> 
</form>

While all the following items show what I want it to show, see below:

<form action="" method="post">
                                        <input type="hidden" name="todo" id="todo" value="add_message">
                                        <input type="hidden" name="order_id" id="order_id" value="2899">
                                        <textarea class="whatever" name="message_content" id="message_content" placeholder="Enter your comment here"></textarea>
                                        <input type="submit" name="" value="Submit" style="margin-top:15px;"> 
                                    </form>

Any idea what is causing this all of a sudden, or better said how to get rid of it?

Read more here: Quicktag auto inserted into first foreach loop item

Leave a Reply

Your email address will not be published. Required fields are marked *