Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Talk:Writing Code in Your Posts

What about the bug wher " get displayed as \" ?

Please direct support questions to the WordPress Support Forum. Using a \ before a " is called an "escape". I have not heard of a "bug" in WordPress related to this. But if you have found one, see: Submitting Bugs. Lorelle 21:28, 23 Jun 2005 (UTC)

skippy 21:36, 23 Jun 2005 (UTC): quote marks cannot be stored directly in the MySQL database, because quote marks are used in the SQL language. So what happens is every quote mark gets escaped: a backslash character is prepended, which signifies that the next character should be taken as part of the input, and not as part of the SQL command. When pulling data out of the database, the backslashes are not automatically removed. You must call stipslashes() on the text.

Entered above information into article. Lorelle 15:19, 25 Jun 2005 (UTC)

skippy 15:42, 25 Jun 2005 (UTC): The term "arrows" is used to describe < >. I've always called them "angle brackets", because they're not really arrows. Thoughts?


skippy 15:49, 25 Jun 2005 (UTC): Why are we linking to pastebins at the end of this article? They're not referenced in the body anywhere, are they?

Arrows are what they are "most" commonly, if inappropriately, called. We go for common here. ;-) Some people think ][ are angle brackets when they are just "brackets". If so, what are these }{? Braces. See. So arrows becomes easier to differentiate. I thought a mention of using pastebins was mentioned and I see it got overlooked. Good catch. Thanks.
Please check the new area with the info on the escaping quotes. I'm not sure I translated that right. Thanks. Lorelle 15:59, 25 Jun 2005 (UTC)

skippy 00:34, 26 Jun 2005 (UTC): Do we even need the "quotes from the database" bit here? It has nothing to do with writing code in your posts....


bzend 19:44, 14 Aug 2006 (UTC): I was discovering the wonderful word of WordPress, and was delighted with everything I saw, from the beautiful design to the clear admin interface, until I stumbled upon a major flaw: its handling of code. I need have code snippets in my blog, and the fact that the rich text editor cannot be disabled, and that it strips away line breaks from pre tags unfortunately makes WordPress not an option for me. I hope this gets fixed some day! Until then, I'll stick with b2evo.

You need to turn off the rich text editor for EACH user on the wordpress/wp-admin/profile.php page.--HalCanary 19:15, 20 Sep 2006 (GMT)

<pre>\n</pre>

There's a bug where <pre>printf("hello world\n");</pre> gets displayed as printf("hello worldn");. To compensate, I use <pre>printf("hello world&#0092;n");</pre>

Is there a better solution?--HalCanary 19:34, 20 Sep 2006 (GMT)

2 backslashes seem to be working too: \\ --Katpatuka 19:48, 21 Jan 2007 (UTC)