• Just upgraded to 2.0. (Nice!) I went to add some custom fields to my post and the keys “_encloseme” and “_pingme” appeared without my permission. I attempted to edit the custom fields and they do not appear in the edit area. I deleted the post and started over. The unwanted fields are still there and I can’t get rid of them.

Viewing 6 replies - 16 through 21 (of 21 total)
  • I’ve noticed that I don’t see those odd custom fields (_encloseme, _wp_pagetemplate, etc) until I add a new custom field or type what I believe to be the existing field into the middle textfield…. then those others show up in the menu after clicking add new field.

    Is there no way to hard-code the available meta field keys into the menu? It sucks to have to write a complete manual for someone because the WP one either doesn’t explain “yeah, but, it’s broken and buggy, so you may not see the right meta key listed… so here’s a list of existing keys and you can just type them in, but get them correct or else they won’t display in your page…”

    I’d like to just hard code in the list of keys to display in the Write/Edit post form.

    Anyone know how?

    I run in the same problem – but i found out how can fix it ??

    First, you need in your wp-admin.css a definition for the class hidden. Like this:

    .hidden {
    display: none;
    }

    This will hide all rows with the class hidden.

    To hide the _enclose and _pingme entries in the selectbox for the customfields, you must edit the file /wp-admin/admin-functions.php.

    Go to line 878. Near this line you must found
    foreach ($keys as $key) {
    echo “\n\t<option value=’$key’>$key</option>”;
    }

    Replace this with the following code:
    foreach ($keys as $key) {
    if ((0 !== strpos(trim($key), ‘_’)) {
    echo “\n\t<option value=’$key’>$key</option>”;
    }
    }

    Ok, thats all

    I’m afraid Kex’s solution doesn’t work for me – I’ve tried it a dozen times and it just gives me: “parse error, unexpected {, line 878”

    i have been having this problem ever since i upgraded to 2.0.4. i see that there is a ticket but no fix? this is what happens to me:

    i write a post (not using custom fields), publish the post, and then encloseme1 and pingme1 appear underneath my public post. it is UGLY! i have learned to work around it by going into the post and choosing pingme_1 as a custom field, leaving the text in it blank, and publishing the post again.

    what is interesting is that when i initially write a post, encloseme and pingme are not options in the custom fields drop-down list. after the post is written and the fields appear on the published post, when i go back in to edit it, pingme and encloseme are part of the custom field drop-down menu.

    so i came around here and have implemented wblogan’s fix. it works just fine. thank you!!!

    Hi everyone,

    First, I just recently also came across this problem. I found kex’s solution worked best for me, though I implemented it differently. I am using 2.0.5.

    Here’s my fix:

    1. open /wp-admin/admin-functions.php
    2. in that file search for the phrase “$keys as $key”
    that should bring you to code that looks like:

    foreach ($keys as $key) {
    $key = wp_specialchars($key, 1);
    echo "nt<option value='$key'>$key</option>";

    }

    3. Replace the code above with this code:


    foreach ($keys as $key) {
    $key = wp_specialchars($key, 1);
    if (substr($key, 0,1) != '_' ) {
    echo "nt<option value='$key'>$key</option>";
    }
    }

    If the first character of the custom field isn’t an underscore, it gets displayed, otherwise it doesn’t.

    Second, if you’d like to display all your custom fields at one time, rather than the most recent 10, do the following

    1. Open up that same file as in step one above
    2. Find this code

    $keys = $wpdb->get_col("
    SELECT meta_key
    FROM $wpdb->postmeta
    GROUP BY meta_key
    ORDER BY meta_id DESC
    LIMIT 10");

    3. Replace the number 10 with a number that accomodates your additional fields. It’s probably a good idea to go with your custom fields rounded up a little rather than something arbitrarily large since this is hitting your database.

    That’s all…hope that helped someone!

    Jen

    Thanks Jen – completely fixed both bugs I was experiencing ??

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘Trouble with Custom Fields in 2.0’ is closed to new replies.