I have recently determined through trial and error and process of elimination that Zemanta is responsible for adding extraneous HTML comments to my pre-formatted (with “pre” tags) PHP code that I have placed between “sourcecode” tags to activate WordPress.com’s built in programming code syntax highlighting.
Here is a screenshot (fig 1.) that demonstrates the problem:
See, all that green is what commented my code out and made it so it doesn’t display correctly.
I am not totally sure Zemanta is to blame, but it seems the most likely culprit. Here’s why:
Identified 3 possible suspects: Zemanta, WordPress.com proofreading, and pasting pre-formatted code in Visual view instead of HTML view.
Disabled Zemanta and retested – problem remained.
With Zemanta disabled, disabled proofreading as well. No change.
With Zemanta and proofreading disabled, went Edit>HTML View. In each instance where I had posted code, deleted all the code from in between “sourcecode” tags.
Re-copied and pasted code from each original PHP file. Re-tested: Worked! Syntax highlighting works properly now. Made multiple edits to both code and text, updated and viewed the post — Good to go every time.
Re-enabled Zemanta, made a test edit, saved and previewed the new post. Everything is messed up again! This is why I think Zemanta is the issue.
DO NOT, (under any circumstances) have Zemanta enabled if you have preformatted PHP code in your blog. Chances are, Zemanta will mess your code up and you will have to re-paste your code again. During my tests, I have had to paste all my sourcecode from scratch 3 times and let me tell you — it gets very tedious and wastes valueable time.
Always paste sourcecode in HTML view only.
These are my recommendations based on my personal experience with this issue. I’d love to hear from anyone else who is having similar issues. Please let me know if this solution worked for you!
This WordPress administration tutorial is for self-hosted WordPress websites and is intended to teach users how to add and remove new posts. If you found this video helpful, please leave a comment below! 🙂 HAVE AN IDEA FOR A VIDEO? I love sharing my knowledge with others, and by sharinging and communicating in a loving […]
WAMPServer doesn’t work. I launched the application from the taskbar in Windows 10, but the “W” in system tray doesn’t turn green, it just stays red. There is also an error when I hover over the W: Local server – None of 2 services running SEARCH TERMS I TRIED Here are some search terms and […]
In today’s world, the job market is more competitive than ever. With online job boards, phone screens, and employers researching you on social media, it is easier than ever to be ruled out as a potential job candidate before you ever have a first interview. However, there are a few things you can do to […]
The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.