Forums
Forums / Plugin: Toolset Types - Custom Post Types, Custom Fields and Taxonomies / Hook for custom dropdown options
(@enderoe)
11 years, 3 months ago
Hi,
Is it possible to create options in a select with a hook?
https://ww.wp.xz.cn/plugins/types/
(@iworks)
Hi enderoe
Use wpt_field_options:
wpt_field_options
function my_wpt_field_options( $options, $title, $type ) { switch( $title ) { case 'a name of select field': $options[] = array( '#value' => 'xxx', '#title' => 'dynamic add some option', ); break; case 'a name of radio option': $options[] = array ( '#value' => 'xxx', '#title' => 'dynamic added radio', '#validate' => array (), '#after' => '', ); break; } return $options; } add_filter('wpt_field_options', 'my_wpt_field_options', 10, 3);
cheers,
Marcin
The topic ‘Hook for custom dropdown options’ is closed to new replies.