Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created April 8, 2020 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/58e50a14c596c2fa4268a6e3bda49667 to your computer and use it in GitHub Desktop.
Save billerickson/58e50a14c596c2fa4268a6e3bda49667 to your computer and use it in GitHub Desktop.
<?php // don't include this line
/**
* Display Posts, category by author name
*
*/
function be_dps_category_author_name( $args, $atts ) {
if( is_user_logged_in() ) {
$current_user = wp_get_current_user();
$got_login_name = $current_user->user_login;
$args['category_name'] = $got_login_name;
}
return $args;
}
add_filter( 'display_posts_shortcode_args', 'be_dps_category_author_name', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment