Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * This snippet will include other wp roles in event author dropdown
- */
- function my_em_override_wp_dropdown_uses($output){
- global $post, $user_ID;
- if( in_array($post->post_type, array(EM_POST_TYPE_EVENT, EM_POST_TYPE_LOCATION,'event-recurring')) ){
- // return if this isn't the theme author override dropdown
- if (!preg_match('/post_author_override/', $output)) return $output;
- // return if we've already replaced the list (end recursion)
- if (preg_match ('/post_author_override_replaced/', $output)) return $output;
- // replacement call to wp_dropdown_users
- $output = wp_dropdown_users(array(
- 'echo' => 0,
- 'name' => 'post_author_override_replaced',
- 'selected' => empty($post->ID) ? $user_ID : $post->post_author,
- 'include_selected' => trues
- ));
- // put the original name back
- $output = preg_replace('/post_author_override_replaced/', 'post_author_override', $output);
- }
- return $output;
- }
- add_filter('wp_dropdown_users', 'my_em_override_wp_dropdown_uses');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement