Title: WP bizarre code rewriting
Last modified: August 19, 2016

---

# WP bizarre code rewriting

 *  Resolved [desertmariner](https://wordpress.org/support/users/desertmariner/)
 * (@desertmariner)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/tinymce-bizarre-code-rewriting/)
 * Either TinyMCE or WP are driving me nuts! I’ve disabled the visual editor for
   writing so I can put in straight html. I put the following href anchor onto a
   page:
 * `<a href="http://website.com/func/?search=Asearch 1; Bsearch 2 &param=31">website
   link text</a>`
 * I save the page and preview it. This is what WordPress sends to my Firefox browser:
 * `<a href="http: &param="31" target="_blank"" 1="" Bsearch="" 2;="" ?search="Asearch"
   func="" website.com="">website link text</a href="http:>`
 * I have TinyMCE Advanced installed and active, and TinyMCE Valid Elements installed
   and active. The only elements and attributes I have entered into TinyMCE Valid
   Elements are:
    a, target, href
 * If I save the page, and close it, and then open it again, the code is unchanged,
   so I don’t know if the problem is WP or TinyMCE. I’d sure appreciate some help.
 * Thank.

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Thread Starter [desertmariner](https://wordpress.org/support/users/desertmariner/)
 * (@desertmariner)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/tinymce-bizarre-code-rewriting/#post-1274059)
 * Update:
 * I looked in the database to see how the page is being stored. The code is storing
   correctly, so this is probably not a TinyMCE issue but rather a WP issue. It 
   looks like WP is rearranging the the html on the way to the browser. Am I failing
   to escape some special characters or something?
 *  Thread Starter [desertmariner](https://wordpress.org/support/users/desertmariner/)
 * (@desertmariner)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/tinymce-bizarre-code-rewriting/#post-1274075)
 * Update #2:
 * I wrote a quick plugin to use the exact same code. It works fine. So, the same
   anchor tag works in a plugin (and I pull the code from a database field just 
   like the page does), but it doesn’t work in a page. Frustrating!
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/tinymce-bizarre-code-rewriting/#post-1274126)
 * Have you tried deactivating TinyMCE Advanced and TinyMCE Valid Elements?
 *  Thread Starter [desertmariner](https://wordpress.org/support/users/desertmariner/)
 * (@desertmariner)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/tinymce-bizarre-code-rewriting/#post-1274139)
 * Yes, I have deactivated both plugins. I get the same result.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/tinymce-bizarre-code-rewriting/#post-1274143)
 * Any other plugins running? If so, have you tried deactivating them or [resetting the plugins folder](http://codex.wordpress.org/FAQ_Troubleshooting#How_to_deactivate_all_plugins_when_not_able_to_access_the_administrative_menus.3F)
   by FTP or phpMyAdmin? Sometimes, an apparently inactive plugin can still cause
   problems.
 * Have you tried switching to the default theme to rule out any theme-related problems?
   Or re-uploading the wp-admin and wp-includes folders from a fresh download of
   WP?
 *  Thread Starter [desertmariner](https://wordpress.org/support/users/desertmariner/)
 * (@desertmariner)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/tinymce-bizarre-code-rewriting/#post-1274152)
 * I deactivated all plugins (renamed the plugins directory), switched to the default
   theme, and uploaded fresh copies (freshly downloaded from wordpress.org) of both
   wp-admin and wp-includes. No help. WordPress is still scrambling this anchor 
   code.
 *  Thread Starter [desertmariner](https://wordpress.org/support/users/desertmariner/)
 * (@desertmariner)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/tinymce-bizarre-code-rewriting/#post-1274157)
 * Now I’m REALLY baffled! I went into the editor and entered the exact same link
   using the editor “Link” button. The code deposited by the editor into the edit
   screen is EXACTLY the same as the hand coded anchor I typed into the editor, 
   yet when I preview the page the one entered with the “Link” button renders correctly
   while the hand entered one is scrambled.
 * I further looked at the post content field in the database. Both links are shown
   in the field and both are identical. I don’t get it! I’m very experienced in 
   relational database. I’ve looked through the tables and can’t see any data relationships
   that tell wordpress that one is a valid link and the other isn’t.
 * I need to put 730 of these links on the page, so it makes no sense to have to
   hand enter each one. There HAS to be a secret key to this problem.
 *  Thread Starter [desertmariner](https://wordpress.org/support/users/desertmariner/)
 * (@desertmariner)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/tinymce-bizarre-code-rewriting/#post-1274161)
 * I can’t tell you how much I HATE Microsoft sometimes. The code I’m trying to 
   use I created in Excel. I copied the code out of Excel and into Notepad thinking
   it would clean it of any non-printing characters. I would then save the .txt 
   file, reopen it cut the code out of it and paste it into wordpress. Apparently
   this isn’t enough! Saving the data from Excel as text isn’t enough either! You
   have to cut it out of Excel, paste it into Word, save the word file as “plain
   text”, open that file, cut the text out of it and paste it into WordPress. THEN
   it works! I HATE Microsoft! If notepad says it saves in .txt format, one would
   expect it to save clean text! I HATE Microsoft! Issue resolved. Thanks for listening.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘WP bizarre code rewriting’ is closed to new replies.

## Tags

 * [code stripping](https://wordpress.org/support/topic-tag/code-stripping/)
 * [html](https://wordpress.org/support/topic-tag/html/)
 * [tinymce](https://wordpress.org/support/topic-tag/tinymce/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [desertmariner](https://wordpress.org/support/users/desertmariner/)
 * Last activity: [16 years, 7 months ago](https://wordpress.org/support/topic/tinymce-bizarre-code-rewriting/#post-1274161)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
