Support » Fixing WordPress » Custom field limit?

  • Resolved frescova

    (@frescova)


    I haave lots of custom fields for a very specific installation of WP which I’m using as a CMS.

    Is there a limit to the number of custom fields that show up in the custom field drop-down? Until recently, every time I added a new field to a post that custom field would display in the drop-down, making it easy to add again to a new post or when editing a post – seems like now I’ve reached a limit and the new fields I add don;t show up.

    Can this be changed?

    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • There’s a limit of 30 set in wp-admin/includes/template.php, however there is a filter hook postmeta_form_limit available if you wish to change it..

    Here’s an example:

    add_filter( 'postmeta_form_limit' , 'customfield_limit_increase' );
    function customfield_limit_increase( $limit ) {
    	$limit = 100;
    	return $limit;
    }

    Hope that helps..

    Cool 🙂
    Thanks for the info…

    You’re welcome… 😉

    Thanks, t310os_ !!!
    This was the reason also in my case.

    Bye the way where do I need to add the filter?? I understand these filters can be inserted in plugins. As I’m not working on a plugin, I applied the change directly to template.php file.

    In your theme’s functions.php file would have been fine, or alternatively in a plugin like so..

    <?php
    /*
    Plugin Name: Increase Custom Field Limit
    */
    add_filter( 'postmeta_form_limit' , 'customfield_limit_increase' );
    function customfield_limit_increase( $limit ) {
    	$limit = 100;
    	return $limit;
    }

    I placed this function in my functions.php file but nothing happens… what am I doing wrong?

    Assuming you placed the code into wp-content/themes/*yourtheme*/functions.php you didn’t do anything wrong…

    ..where *yourtheme* will be your theme name…

    That’s really weird. I have several custom fields, and none of them are affected.

    Are you sure you can see the change, and that you understand what this code does. To clarify, the above code increases the amount of custom fields shown in the dropdown when choosing a custom field in the editor, it’s usually hard-coded to display 40 maximum (if memory serves).

    You will not see any difference unless you have lots of custom fields (well more then the current limit)..

    If you’re looking for something else, please start a new thread describing what you wish to do (rather then taking this thread off-topic, it’s also resolved already).

    my apologies. I misunderstood the code. thanks for clarifying!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Custom field limit?’ is closed to new replies.