This code will display the post from current user. Put the code into Bricks Builder Query Editor.

$current_user = wp_get_current_user();
return [
    'post_type'      => 'post',
    'author'         => $current_user->ID,
    'posts_per_page' => -1
];

$current_user = wp_get_current_user();: This line retrieves the currently logged-in user in WordPress and assigns it to the variable $current_user. The function wp_get_current_user() returns a WP_User object representing the current user.

The return statement: This code block appears to be within a function, and it returns an array with specific parameters for querying posts:

  • 'post_type' => 'post': This specifies that the query should retrieve posts of the post type ‘post’. In WordPress, ‘post’ is the default post type for blog posts.
  • 'author' => $current_user->ID: This parameter filters the query to only retrieve posts authored by the currently logged-in user. It uses the ID property of the $current_user object to specify the author.
  • 'posts_per_page' => -1: This parameter ensures that all posts authored by the current user are retrieved, as -1 indicates that there is no limit to the number of posts returned.

Putting it all together, this code snippet is essentially creating a custom query to retrieve all posts authored by the currently logged-in user in WordPress. This could be useful, for example, if you wanted to display a list of posts authored by the current user on their profile page or in a custom dashboard widget.