Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// EUD - admin fields ##
\add_filter( 'q/eud/api/admin/fields', [ get_class(), 'api_admin_fields' ], 10, 1 );
/**
* Filter add extra admin fields in EUD plugin
*
* @since 2.0.0
*/
public static function api_admin_fields( $array )
{
// add program
if ( \post_type_exists( 'program' ) ) {
// define ##
$program = [
'title' => \__( 'Programs', 'q-export-user-data' ),
'label' => 'program',
'type' => 'select',
'description' => \__( 'Select the program that you wish to export.', 'q-export-user-data' ),
'label_select' => \__( 'All Programs', 'q-export-user-data' ),
'options' => \get_posts([ // grab all posts of type "program" ##
'post_type' => 'program',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC'
]),
'options_ID' => 'ID',
'options_title' => 'post_title'
];
// add to array ##
array_push( $array, $program );
}
// kick back array to filter ##
return $array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment