Trying to echo posts of author on user page
-
I am trying to echo all author posts for each user as URLs with user_id as the author id in a custom column within the User List table (User.php)… not sure what is wrong.. Thanks!
function new_modify_user_table_send_inv( $column ) { $column['send_inventory'] = 'Email Inventory'; return $column; } add_filter( 'manage_users_columns', 'new_modify_user_table_send_inv' ); function new_modify_user_table_row_send_inv($custom_column, $column_name, $user_id ) { if ($column_name=='send_inventory') { $posts = get_posts(array('author'=>$user_id)); $custom_column = array(); if(isset($posts) && !empty($posts)) foreach($posts as $post){ $custom_column[] = "<li>".$post->post_title."</li>"; } $custom_column = implode("\n",$custom_column); } return $custom_column; } add_filter( 'manage_users_custom_column', 'new_modify_user_table_row_send_inv', 10, 3 );
- The topic ‘Trying to echo posts of author on user page’ is closed to new replies.