WordPress.org

Forums

The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Custom meta boxes for custom post types (3 posts)

  1. d910qf
    Member
    Posted 6 years ago #

    I'm using the following two lines and 2 functions to enable a custom meta box for posts - is it possible to enable these for custom post types?

    add_action('admin_menu', 'my_add_custom_box');
    add_action('save_post', 'my_save_postdata');

    Post types have been registered with code like so:

    register_post_type( 'projects', array(
    	'label' => __('Projects'),
    	'public' => true, 'show_ui' => true ,
    	'supports' => array('title', 'author','editor','excerpts', 'custom-fields', 'revisions', 'comments' )
    	)
    );
  2. d910qf
    Member
    Posted 6 years ago #

    Yes you can...

    add_meta_box( 'myplugin_sectionid', __( 'Background Image', 'hybrid' ), 'myplugin_inner_custom_box', 'projects', 'advanced', 'high' );
  3. idealien
    Member
    Posted 6 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.