• Hi there, thanks for the great plugin first of all!

    I’m trying to pull in a list of posts for a custom post type and I don’t get anything in my select field. Here’s my code:

    function register_user_fields() {
    	slt_cf_register_box( array(
    		'type'		=> 'user',
    		'title'		=> 'Member Profile Page',
    		'id'		=> 'profile-page-options',
    		'context'	=> 'normal',
    		'priority'	=> 'high',
    		'fields'	=> array(
    			array(
    				'name'			=> 'profile-page',
    				'label'			=> 'Profile Page',
    				'type'			=> 'select',
    				'scope'			=> array( 'administrator', 'editor' ),
    				'capabilities'	=> array( 'edit_posts' )
    			)
    		),
    		'options_type' => 'posts',
    		'options_query' => array(
    			'posts_per_page' => -1,
    			'post_type' => 'member'
    		)
    	));
    }
    add_action('init','register_user_fields');

    I’ve got a bunch of members added so there are posts there. Am I doing something wrong?

    Thanks,
    Jonah

    https://www.ads-software.com/extend/plugins/developers-custom-fields/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Steve Taylor

    (@gyrus)

    Hi Jonah, what you need to do is put the options_type and options_query parameters inside the array for the profile-page field where they belong! ??

    A “box” isn’t really a good term for a group of fields on a user screen, but the plugin started life just handling post meta boxes. But still, when you register a box, it’s a group of fields, and each field’s parameters need to be in its array.

    Thread Starter jonahcoyote

    (@jonahcoyote)

    Hey Steve, thanks for the reply, that makes sense and it now works perfectly!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Developer's Custom Fields] Query Custom Post Type’ is closed to new replies.