Support » How-To and Troubleshooting » Code reverts to '&#039' in header.php

Code reverts to '&#039' in header.php

  • Hi,

    I’m not sure how to explain this but the header.php file in my theme keeps changing by itself (or I’m guessing it’s being hacked in some way or another.) All the quote marks in code convert to ‘&#039’ html code and it’s only happening in the header.php file in my theme. I have no idea how this is happening. I change the code back and re-upload the file but the code reverts back to ‘&#039’ after every few hours. So strange!

    For example the code should look like this:

    <meta http-equiv=”Content-Type” content=”<?php bloginfo(‘html_type’); ?>; charset=<?php bloginfo(‘charset’); ?>” />

    But then it converts to ‘&#039’ by itself after few hours later:

    <meta http-equiv=”Content-Type” content=”<?php bloginfo( ‘&#039’ html_type ‘&#039’ ); ?>; charset=<?php bloginfo(‘&#039’ charset ‘&#039’ ); ?>” />

    This then causes a php error – Parse error: syntax error, unexpected ‘;’ in ../wp-content/themes/A/header.php on line 21

    My files are set to the correct permissions via FTP.

    Please help! Anyone have any ideas why this could be happening?

    Thanks in advance.

Viewing 12 replies - 1 through 12 (of 12 total)
  • ‘html_type’ – Returns the Content-Type of WordPress HTML pages (default: text/html). This data is retrieved from the ‘html_type’ record in the wp_options table. Themes and plugins can override the default value using the pre_option_html_type filter.

    Codex Reference

    Thanks for the info! But I’m not sure I understand. How exactly can I fix the issue? Do I need to change the pre_option_html_type filter through the database to something else? I’ve never had this problem before with any other of my WP sites.

    Links are provided for a lengthy review by OP’s.

    Thanks Seacoast but I’m still not sure what exactly the issue is but I have for the meantime disabled the file editor in wordpress. (I think it might help security wise.)

    If anyone out there has any solutions please let me know thanks!

    What I meant is that you stated you did not understand the issue, but minutes later (a few) replied you had in fact studied the link and it was not helpful – it is…it’s not an issue with the link…please study it in whole over time…

    It looks like for some reason however you were editing the header.php wasnt decoding the html entities correctly

    &#039 is a ‘

    if you can.. use FTP and a php editor (Notepad++ is always good) to the changes to your header.php and then reupload it to your theme..

    I have studied the link you provided and it was helpful but it doesn’t solve my issue. It’s not about ‘get_bloginfo()’. The problem is the quotation mark – ‘ – is automatically converted to ‘&#039’ code in my header.php file (no other file).

    Did you download and edit this file at any time?

    I always use FTP to edit the files and I haven’t had issues with it in the past (no one else edits the files expect me this why I was thinking it might be hacked?). When the PHP syntax error appeared I noticed through the WP editor all the ‘ were converted to &#039. So I disabled the editor by adding – define(‘DISALLOW_FILE_EDIT’, TRUE); in the wp-config file just in case if it’s being hacked somehow.

    It’s very strange I haven’t had this issue before with WordPress.

    This file is likely corrupt, contains a BOM, or other error(s), recreate it.

    Yes, I think your right. I have recreated the header file and uploaded it through FTP. The editor is disabled so I’m hoping this will work.

    This happens of late when one uses FileZilla, downloads, edits, does a save (in edit mode of file with default as notepad) but not : ‘saveas UTF-8 with no BOM’ and prior to opening Notepad does not have ‘word-wrap off’… MS has promised to fix this occasional glitch once WP is nice again to them (oops). Darn BOM! What is BOM for?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Code reverts to '&#039' in header.php’ is closed to new replies.
Skip to toolbar