apply_filters( 'postslistdropdown_optionslist',
array $optionslist );
Filters the list of available posts in the assignment dropdown.
Parameters
- $optionslist
- (array) The list of posts.
Source
floorplans/includes/class‑postslistdropdown.php
More Information
This code should be implemented in PHP. For extra guidance, please see WPBeginner’s tutorial on adding custom code.
Example
function my_postslistdropdown_optionslist( $optionslist ){
// assuming you want to remove posts with category nr 46
foreach( $optionslist as $title => $type ){
if( $title !== 'Posts' )
continue;
foreach( $type['posts'] as $idx => $post ){
if( ! in_array( '46', explode( ',', $post['categories'] ) ) )
continue;
unset( $optionslist[$title]['posts'][$idx] );
}
}
return $optionslist;
}
add_filter( 'postslistdropdown_optionslist', 'my_postslistdropdown_optionslist', 11, 3 );