• amexing

    (@amexing)


    When I draft a regular post, I do see the option to enable “Custom Fields” by pulling down screen option, however, this option to create custom fields is not available when the post type is question (which is a custom post type in my theme)

    How can I enable that option even for custom post types.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Faisal Ahammad

    (@faisalahammad)

    You must edit your custom post type code to add the custom fields support. Here is the example code you may follow:

    $args = array(
            'labels'             => $labels,
            'public'             => true,
            'publicly_queryable' => true,
            'show_ui'            => true,
            'show_in_menu'       => true,
            'query_var'          => true,
            'rewrite'            => array( 'slug' => 'quiz' ),
            'capability_type'    => 'post',
            'has_archive'        => true,
            'hierarchical'       => false,
            'menu_position'      => null,
            'supports'           => array( 'title', 'editor', 'thumbnail', 'custom-fields' )
        );
    Thread Starter amexing

    (@amexing)

    Thank you both, I thought there maybe some easy option like enabling some checkbox or something else from front end. For now I am not going with installing plugin or adding any additional code.

    Was under the impression that option to create custom fields should be available to all post types by default.

    Thread Starter amexing

    (@amexing)

    I thought to go ahead with plugin and created a custom field of type Wysiwyg Editor but the problem is that content is not formatted properly. It is showing all of them in a single lines as shown in the image below.

    Any idea what needs to be done here.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to enable “Custom fields” option for custom post type’ is closed to new replies.