Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter plavet

    (@plavet)

    Reading the link you’ve posted, maybe its best to use get post stati() to get post status, maybe future proof? eg. will work for custom post status too. Just tried it and it works

    if ( $pto->hierarchical ) {
    	$pstat = get_post_stati();
    	$selects .= wp_dropdown_pages(
    		array(
    			'post_type' => $type,
    			'post_status' => $pstat,
    			'selected' => $mydata->$language,
    			'name' => 'msls_input_' . $language,
    			'show_option_none' => ' ',
    			'sort_column' => 'menu_order, post_title',
    			'echo' => 0,
    		)
    	);
    }
    Thread Starter plavet

    (@plavet)

    Hi,

    i did some testing, first, plugin works fine for posts, it does show future posts and draft ones too, but only published ones for custom post types, then i added 'post_type' => 'any' on line 25 and on lines 133 and 147 (MslsMetaBoxx.php) overriding current ones, what i get was, getting everything in dropdown for posts, but nothing in dropdown for custom post type, narrowing down, culprit was 'post_type' => 'any' on line 133, then i went like hmmm that is strange lol, and tried adding 'post_status' => 'any' instead of ‘post_type’ => ‘any’, i returned to default values, only added/changed those 2 values, result was no dropdown for custom post type, strange again lol i guess there is a problem with ‘any’ in that array, a bug in wp maybe? Anyway, to conclude I’ve added 'post_status' => array('publish', 'future', 'draft', 'pending'), on line 133 below 'post_type' => $type, (it’s the array for if ( $pto->hierarchical ) statement) and everything works! Dropdown for custom post types now shows everything, still strange though why 'post_type' => 'any' kills the dropdown for custom post type.

Viewing 2 replies - 1 through 2 (of 2 total)