internet, tutorials

custom fields problem fix – wordpress

Okay, i have been pulling my hairs since yesterday ( whatever left of it at least ) trying to solve this issue!

Scenario:

You login to the admin panel in wordpress to publish a new post or page with custom fields, you enter the custom field key and value then click “add custom field” button but nothing happens, the truth is it actually inserts the key and the value, the problem is there is no Ajax/Jquery visual feedback .

By examining the console window using firebug, you’ll get the following when clicking the button:

XML or text declaration not at start of entity
[Break on this error] ... position='1'>< ![CDATA[

Solution:

Believe it or don’t, if you have been working on the file function.php make sure you remove extra line breaks top to bottom!
And yeah im serious! Extra line breaks were the reason why custom fields were misbehaving!

Related posts:

  1. WordPress for IPhone is now Available
  2. My ex-boyfriend – Zain ( by an angry friend )

Tags: , , , , , , , , ,

8 Responses to “custom fields problem fix – wordpress”

  1. On May 10, 2010 at 11:38 am Sean responded with... #

    Super helpful post. I had the same problem and I posted about it (and gave you credit) on my site. Your fix worked great, though in my particular case I had to remove line breaks from places other than the beginning and end.

    Thanks for the solution!

  2. On August 12, 2010 at 10:28 am Klauzz responded with... #

    Wow… you are a guru!
    I filnally solved this problem!
    Thank you for your post!

    Klauzz

  3. On February 17, 2011 at 1:50 am Evan W. responded with... #

    Wow, thanks for this fix. I had two extra lines at the end of my functions.php and deleting them instantly made the Custom Fields AJAX start working again.

  4. On March 27, 2011 at 4:30 pm Ezzal Games responded with... #

    wow, this is hard to believe but fixed my problem too !

    you saved my time !

  5. On May 5, 2011 at 8:03 pm Hugh responded with... #

    Hi Moe,

    Thanks a million for this fix.

    This had me close fury for a whole day!

    I owe you a beer.

  6. On November 2, 2011 at 10:21 am James responded with... #

    Moe!
    I had missing custom fields & problems in updating them…

    You have saved my project, thanks a bunch wordpress guru!.

    J

Trackbacks/Pingbacks

  1. Wordpress Oddities: Custom Field AJAX Issue | Seriouslysean.com; The online portfolio of Web Developer and Programmer, Sean Kennedy - May 10, 2010

    [...] after searching google for various different phrases relating to this issue, I happened across this blog post on zainals.com. The answer was so simple. Iit ended up being extra line breaks in my theme’s functions.php [...]

  2. Wordpress Oddities: Custom Field AJAX Issue | Sean Kennedy, Programmer - November 1, 2011

    [...] after searching google for various different phrases relating to this issue, I happened across this blog post on zainals.com. The answer was so simple. Iit ended up being extra line breaks in my theme’s functions.php [...]

Add your response