Support » Developing with WordPress » Custom fields show for custom post type

  • Resolved Bloke

    (@bloke)


    I have a custom post type that has custom fields. Is there a way to have them always appear in the post editor? I have to add them each time I make a new post. There are some in a list that were added from plugins but not the ones I created.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You should probably look into a plugin that can handle custom fields settings for a post type, such as Advanced Custom Fields or Carbon Fields. These plugins provide a way to setup fields permanently for posts making them easier to update and display. If you need further assistance, feel free to ask for additional help.

    Moderator bcworkz

    (@bcworkz)

    You can create your own meta box that collects user input in any form you like.
    https://developer.wordpress.org/plugins/metadata/custom-meta-boxes/

    Like Brian suggests, a custom fields plugin is much easier.

    Thanks. Installing a plug is not the approach I’m looking for. I was trying to find a way for my plugin to work like the others have. Maybe I need to have meta boxes. Right now its “custom fields” at the bottom the page.

    Moderator bcworkz

    (@bcworkz)

    Metaboxes are unique entities in that they can be moved around by the users. When your box first appears it too will be at the bottom of the screen or properties stack. It’s an improvement over the default custom fields because you can have specific fields always visible and use any kind of input field. Users don’t have to know what field they are looking for, and they can move the box to where they find it most convenient.

    You can instead hook any of the actions that fire within the post edit <form> tags and output input fields. Such fields are not movable like meta boxes are. Source code for the edit form is in /wp-admin/edit-form-advanced.php. You’ll find various actions there.

    /* Increase Postmeta Limit.*/
    
    add_filter( 'postmeta_form_limit', function( $limit ) {
        return 100;
    } );
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.