My last comment reminded me about shortcodes, and lead me to this answer:
function htmlcomment_shortcode( $atts, $content = null ) {
return '<!-- ' . $content . ' -->';
}
add_shortcode( 'htmlcomment', 'htmlcomment_shortcode' );
Add that to functions.php
or your plugin, and then use it in your content like this:
normal text [htmlcomment]commented out text[/htmlcomment]
Related Posts:
- Return $post_id when DOING_AUTOSAVE?
- Including Angle Brackets In Pre Sections
- Anchor Text code string is automatically modified by WordPress
- WordPress is converting & to & inbetween [code] brackets
- Notice: Undefined property: wpdb::$current_post What can be wrong?
- Where to save common libraries?
- source code: WP_INSTALLING vs. WP_SETUP_CONFIG in setup-config.php
- Sublime Video: Playlist which gets all attached videos
- Code Friendly Block Quotes
- Remove line breaks from ?
- How to fix a “globals” issue to avoid a rejected theme?
- How to display php source code inside a post using visual editor?
- Need resource on available functions and objects
- WordPress wp_insert_post() returns 0 but not not wp_error
- I want to remove the home page header image from all other pages
- Proper implementation/use of code/syntax highlighting
- How to remove all comments from JS, HTML, CSS files?
- What data validation we must use in different contexts?
- Need To Post Unformated Code
- Sidebar login: How do I get the username to show after “Welcome”?
- How to manage multiple wordpress project with shared code base
- Block IP Addresses using Code [closed]
- Find Total Authors
- Why does HTML entities are still encoded in Code Block?
- How to create a checkbox to show/hide a field in WooCommerce checkout [closed]
- how to display google maps with javascript
- How to pass https://achecker.ca/ validator? [closed]
- How to write custom code on WordPress?
- Remove Metaboxes
- Google analytics won’t work in wordpress
- Where do I add an action hook & callback in my theme?
- How do I reset my footer.php to its original state? (theme: Origami)
- wordpress prepare error
- Adding code to send referrer on login page
- How do I prevent WordPress from eating my code?
- Table styles disappear when updating content
- Manage recurring event time
- wp_editor save all content
- Need an elegant solution to declare the value of two variables based on the count of the post
- How to insert integration code for CRM?
- A good way to include snippets of code in both posts, pages and Event Manager Template files?
- Anchor Text code string is automatically modified by WordPress
- Return $post_id when DOING_AUTOSAVE?
- Changes in code only show after changing theme
- Code Highlighting in BlockQuote
- feed url problem
- Can you not edit the HTML and PHP of your WordPress without paying?
- Where do I go to add a tag before the closing body tag?
- How to use “Add link” pop up for a WordPress widget
- WordPress Internal @ Mentions
- Add quicktag buttons to the HTML editor
- Disable the Code View in the content editor?
- How to to stop html editor from addig tags to shortcodes, images, etc
- ID’s being stripped out of editor for Admin user in Multi-Site
- Add footer.php to WordPress child theme
- Which theme foundry has clean coded themes, where code is poetry [closed]
- Don’t understand why theming is so strange and twisted [closed]
- WordPress redirect all 404 pages to the Homepage
- Can “ and “ tags be used in the HTML editor?
- WP-Markdown treating java generics like HTML tags
- The custom logo, site title, and description doesn’t appear at the same time
- How to avoid loading wp-load.php from external php scripts?
- get_page_template returning nothing
- How to get the POST TITLE using the POST ID?
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘greenday_head’ not found or invalid function name
- Prevent the Editor From Moving My
- Why does this snippet in a blog post make WordPress crash?
- How to process html editor whole content of a single post
- Why namespaces are rarely used in WordPress plugins?
- pop-up options for custom quicktags
- Insert custom PHP head above in WP pages
- Code is providing a row of data but not formatting it as table
- How to do a code in php and have text before it? [closed]
- Disable File Editing function
- WordPress adding a to my anchor for Read More
- Numbering lines of code with the tag?
- advanced custom fields and contact form 7
- Notion-like editing and layout with a convenient freeform collaborative editor in WordPress? [closed]
- Automate configuration after new/hosted installation
- How do I get access to the CSS Editor
- How to determine if a post was last edited in the Visual Editor
- Looking for a good way to include php code in posts, but using special include markup rather than direct php code
- CSS properties in textarea in the Customizer
- out of nowhere
- Block editor: content resets to the previous state in “Edit as HTML” by clicking somewhere outside of the editing window
- Client on iPad accidentally adding tag to posts while writing
- Why is every single HTML tag being stripped out of liveblog entries?
- Some code is added automatically to my site’s header – what is it?
- How do you find the logo code on theme file or where can I find the header theme file?
- It possible to implement an adhoc php web application with wordpress?
- WYSIWYG with HTML source?
- WordPress editor, change code wrap (bbpress?)
- unexpected added in HTML at each update [closed]
- Show page title just from the first child-page in template
- WordPress adding in anchor elements when I save a page in html editor
- wordpress not saving form code in code editor
- Code snippet plugin not working correctly with Windows live writer and WordPress
- Attachement title in wpallimport
- I want create woocommerec match products columns
- Developing an IP lookup function using an API