Thanks you for confirming that a new filter/hook would be appropriate for your application. I have developed a new mla_media_modal_initial_filters
hook and an example plugin that illustrates its use. You will have to add logic for picking the initial Att. Category term ID based on post type or any other criteria to this new filter:
/**
* MLA Edit Media Initial Filters Filter
*
* This filter gives you an opportunity to change the initial values of the
* Media Manager Modal Window toolbar controls.
*
* @since 1.00
*
* @param array toolbar control initial values
*
* @return array updated toolbar control initial values
*/
public static function mla_media_modal_initial_filters_filter( $initial_values ) {
/*
* Uncomment the error_log statements in any of the filters to see what's passed in
*/
//error_log( 'MLAMediaModalExample::mla_media_modal_initial_filters_filter $initial_values = ' . var_export( $initial_values, true ), 0 );
/*
* The default initial values are:
*
* $initial_values = array(
* 'filterMime' => 'all',
* 'filterMonth' => 0,
* 'filterTerm' => 0,
* 'searchConnector' => 'AND',
* 'searchFields' => array( 'title', 'content' ),
* 'searchValue' => '',
* );
*
* Other values include:
* filterMime: uploaded, image, audio, video, text, application, detached
* filterMonth: year and month, e.g., '201407'
* filterTerm: term ID in the selected taxonomy (NOT term-taxonomy ID)
* searchConnector: 'OR'
* searchFields: name (slug), alt-text, excerpt (caption), terms
*/
// uncomment next lines to set initial values
//$initial_values['filterMime'] = 'image';
//$initial_values['filterMonth'] = '201404';
//$initial_values['filterTerm'] = 175; // term ID in attachment_tags
//$initial_values['searchConnector'] = 'OR';
//$initial_values['searchValue'] = 'de la';
return $initial_values;
} // mla_media_modal_initial_filters_filter
The new hook will be in my next MLA version. If you’d like to test the hook, please send me a note with your e-mail address and I will give you a copy by return e-mail. You can use the Contact Us page at our web site:
Fair Trade Judaica/Contact Us
Thanks for your help and your patience.