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?
- Embedding a custom live chat (gen. from Salesforce) into my WordPress header
- How to display SQL query that ran in query?
- Best collection of code for your .htaccess file [closed]
- What is the meaning of %s, %1$s etc.? [closed]
- Upload Multiple Files With media_handle_upload
- How to use “Add link” pop up for a WordPress widget
- WordPress Visual Editor Stripping HTML Changes
- WordPress Internal @ Mentions
- Include WP_Query in my own PHP file?
- prevent wordpress from rendering line breaks as br tags
- How to get a variable number of posts per post type on the main loop?
- What is this code in my theme’s functions.php? if (isset($_REQUEST[‘action’]) && isset($_REQUEST[‘password’])
- Hide “Add media”, HTML editor from TinyMCE
- What theme is good for posting code? [closed]
- How to replace the content of tinyMCE editor in both text and visual mode using jQuery?
- Add quicktag buttons to the HTML editor
- Create custom [sourcecode] shortcode, the right way?
- how to group custom post types
- Disable the Code View in the content editor?
- Stop WordPress From Removing HTML Comments In Content
- How to create a custom button for the visual editor that adds 4 non-breaking spaces? (plugin or simple code)
- Can I force WordPress to use instead of ?
- Enable / Add Custom Keyboard Shortcuts To Work With WordPress’ HTML Editor
- How to to stop html editor from addig tags to shortcodes, images, etc
- How do i structure my theme folder to avoid one huge list of files
- serialize_blocks breaking html tags in content
- Editing Source Code in WordPress
- Prevent WordPress from adding linebreaks to javascript embedded in a page
- Removing buttons from the html editor
- strip only specific tags (like ), but keep other tags (like )
- Has anyone tried putting PHP ActiveRecord on WordPress?
- API integration with WordPress
- Where can I find the code how wordpress parses a post?
- Preserve white-space in Page
- WP Editor strips input placeholder attribute
- how to make stylesheet appear in theme editor?
- ID’s being stripped out of editor for Admin user in Multi-Site
- data-accordion removed in Visual Editor
- Copyright info change in Theme Child PHP
- How to make WordPress and TinyMCE accept tags wrapping block-level elements as allowed in HTML5?
- VERY new to coding – keep breaking site trying to add to functions.php
- How can I include PHP-Code to my post?
- Problem with tag
- write in functions.php
- Add footer.php to WordPress child theme
- How to add JavaScript code on WordPress properly?
- Formatting ?
- Why does the custom HTML block not preserve the HTML characters?
- WordPress tinymce prints empty P tag and break html format
- How to link to a alternative page in CSS
- How-to stop wordpress from saving utf8 non-breaking space characters
- I want to remove the links from the term list returned by get_the_term_list