Display a Specific Link if User Has Post Published

Version audio de cet article
With this tutorial, we will show you how to display a specific menu item if a user has a Post Type published.
First we need to create a function that will allows us to create a query that will return the number of Post Type published by the user. In this example below, you need to replace the Post Type by yours or the posts. We need to return this query that the result is different than 0.
function themespress_user_has_posts($user_id) {
$result = new WP_Query(array(
'author' => $user_id,
'post_type' => 'any',
'post_status' => 'publish',
'posts_per_page' => 1,
));
return (count($result->posts)!=0);
}