Backslashes in WP LaTeX

Just newly upgraded to WordPress 3.4.1, and I’m dismayed to find that whenever I try to type a LaTeX formula, the backslash disappears. I have to replace \ with \\, but every time I do a save, the two becomes one, and next time it becomes none. After some investigation, I finally got the culprit:


function wp_magic_quotes() {
	// If already slashed, strip.
	if ( get_magic_quotes_gpc() ) {
		$_GET    = stripslashes_deep( $_GET    );
//      $_POST   = stripslashes_deep( $_POST   );
		$_COOKIE = stripslashes_deep( $_COOKIE );

	// Escape with wpdb.
	$_GET    = add_magic_quotes( $_GET    );
	$_POST   = add_magic_quotes( $_POST   );
	$_COOKIE = add_magic_quotes( $_COOKIE );
	$_SERVER = add_magic_quotes( $_SERVER );

	// Force REQUEST to be GET + POST.
	$_REQUEST = array_merge( $_GET, $_POST );

Comment out this line and everything’s fine.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.