Home › Forums › Pro Support › Restrict shown posts to logged in author… Tagged: filter This topic has 3 replies, 2 voices, and was last updated 2 years, 3 months ago by elvin. Viewing 4 posts - 1 through 4 (of 4 total) Author Posts June 7, 2021 at 12:05 pm #31020 JParticipant Hi there, Suppose I want to restrict the list generated by wpsp to posts of the logged-in author, what filter settings will then work? I tried: add_filter( 'wpsp_settings', function($settings){ if(449 == (int) $settings['list_id']){ $settings['author_id'] = get_the_author_id(); } } return $settings; }); But that didn’t work. Thanks for any suggestion. J (BTW: where can I find the list of settings names?) June 7, 2021 at 7:59 pm #31025 elvinModerator Hi there, You’ll have to change the wp_query args to assign the current logged in user’s ID. To get the current user’s ID, use https://developer.wordpress.org/reference/functions/get_current_user_id/ You then filter the query args of the plugin. You either use wp_show_posts_shortcode_args filter, or not use shortcode and use wpsp_display(wpsp_id_here, $args) function. The wpsp free version’s code is open to public. See the settings list here – https://github.com/tomusborne/wp-show-posts/blob/35e410d7800273fc66f211c0f80d553e95d17f83/wp-show-posts.php#L96 June 8, 2021 at 12:18 am #31027 JParticipant Hi, Works! add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) { if(123 === (int)$settings['list_id']){ $user_id = get_current_user_id(); $args['author'] = $user_id; } return $args; }, 15, 2 ); Thanks for your help! J June 8, 2021 at 12:52 am #31031 elvinModerator Nice one! No problem. Glad to be of any help. 😀 Author Posts Viewing 4 posts - 1 through 4 (of 4 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In