Indeed, you need to convert the code to their HTML entities to prevent WordPress (or the TinyMCE editor) from stripping it out. The Visual editor does some of this work for you, in the HTML editor you must do this yourself.
Fortunately, there are syntax highlighter plugins (also based on the same SyntaxHighlighter Javascript library) that do this for you, like SyntaxHighlighter Evolved. With this plugin you can write [php]Your <?php echo 'code'; ?>[/php]
and it will escape and highlight it. (There are other shortcodes too of course, [php]
is just a shorthand.)
Related Posts:
- Syntax highlighting for post/page editor [closed]
- How to work with Syntax Highlighter Evolved?
- Getting selected (highlighted) html from the Visual Editor on Edit Post page?
- Color java code the way it is colored in eclipse [closed]
- Tools for styling code snippet in a web page
- Displaying syntax highlighted code [closed]
- Multi Language Code Snippet in WordPress
- Embedding code snippets in posts with indentation
- Can a developer adopt a plugin marked as “not updated in over 2 years”?
- Help with 4.6. Attachment response object in JSON API plugin
- Prevent publishing the post before setting a featured image?
- Disable qTranslate by post type in admin + disable per page / post ID on front-end [closed]
- How to load different css file for different pages
- Custom rewrite rule is not picked by WordPress
- How can I execute some small piece of PHP code in a sandbox area of my WP?
- Author Specific URL’s in WordPress
- How to install a plugin for a free WordPress site? [duplicate]
- WordPress Plugin Look & Feel
- How to see list of plugins
- Can’t find plugins in menu for wordpress 3.2?
- plugin to search entire posts, blogs, forum, users [closed]
- How to add pagination to wpbakery grid?
- Override plugin text domain in child theme
- Can a plugin still effect a site even after deletion?
- How to get variables from fucntion.php to my plugin files
- Delete Associated Media Upon Page / Post Deletion
- Why wp_mail() function isn’t sending any emails and displaying ‘0’ in Chrome ‘Network’ response
- How to get number of Affected rows from wordpress dbDelta() function
- What function can I use consistently to escape possible HTML for editing and display?
- Headers already sent when I try to add headers via a shortcode
- Test files for plugin development
- Outbound Click Tracking
- Error with Image Slide plug-in/ s3slider in WP
- How to add an automatic refresh in WordPress for a Page/Post or an embedded OneDrive/Excel HTML Code?
- File Storage and Repository for individual user
- Collect user information when click on download link [closed]
- How to allow user to select User ID in Formidable Pro form? [closed]
- Can’t Install Standard Plugins on a Local MAMP installation
- Custom Shortcode Broken in WordPress 3.1
- How to get plugin name from plugin file location
- Recent posts per category loop?
- WordPress as a data-store?
- How do I use add_action on custom widget?
- plugin active error
- Change letters for day name
- Keeping and updating ACF and ACF Pro at the same time
- (WordPress 5.8.3) Function.php or a plugin for better performance? [duplicate]
- Alternate email sending service – eg: AWS SES [closed]
- How to deal with Slow HTTP POST (slowloris) vulnerability
- What is the purpose of WP_CONTENT_URL?
- Control page content visibility based on URL parameter
- WooCommerce Shopping Cart Not Initially Showing Products [closed]
- Elementor Custom Control: How to get input value?
- download button for audio file in post [closed]
- Print posts category or tag as a formatted journal
- Creating a search form and displaying results
- how to design change in woocommerce cart page and all other page also by theme? [closed]
- problem with register_activation_hook in plugin
- should i use GLOB_ONLYDIR to hook add-ons for wordpress plugin
- How to downgrade plugin?
- Build a must-use plugin that tracks when other plugins are activated or deactivated
- Allow webp use on website but disallow webp as featured image during post creation
- Javascript embedded disappears for editors
- Using sessions or an alternative in a plugin
- redirect to homepage once action is completed
- Rewrite/Change custom taxonomy slug
- Can I create a separate admin section for my plugin?
- How to remove default action from a plugin?
- taxonomy_template filter not working on pagination [duplicate]
- How to make this custom capability work? [duplicate]
- Checkbox field that add a subscription product and change prices of other products in checkout and cart page
- WordPress Contact 7 Form – Remove WordPress from the From Sections
- How connect my plugin translation to my page
- Custom author page for custom role
- EventON – Dequeue Styles
- Pagination not working with pagenavi
- multiple string replace of post’s content for large data
- Building a dynamic web app for questionnaire
- Using WordPress to create a simple web app (SaaS) [closed]
- wp_signon returns user, in popup window, but the user is not logged in
- Searched & tried a lot: Is it Possible to Eliminate Render Blocking Manually
- Creating plugin for changing slug
- resizes images on the fly
- WordPress plugin – multiple php files
- Upacking the package… stalls, but installs plugin
- Internationalization of Blog Posts
- WordPress Options-Theme STD (default) value does not work
- Give access only for a period of time [closed]
- How can I save a setting field with multiple checkbox options generated by a foreach loop on a custom wordpress admin page?
- Remove Close Button | Facebook Page Promoter Lightbox [closed]
- Adminimize Plugin — Is there an alternative to limiting Editor to ‘Appearance > Widgets’ only?
- Terms id wordpress error
- How to laod wp_enqueue_style to another header i created my self
- how to set approval of admin for wordpress posts submitted by the user?
- TML Theme My Login Plugin
- Windows Azure Storage for WordPress plugin not listing blob containers [closed]
- What is phpBB? Is it something like a plugin which I can use in WordPress? [closed]
- WordPress s2 member plugin not working [closed]
- Beginner question: Accessing js script in plugin
- Why is my activator class adding the files/running the actions I add?